EditorWindow.OnHierarchyChange 当层级改变

function OnHierarchyChange () : void

Description描述

Called whenever the scene hierarchy has changed.

只要场景层级改变时调用。

This is transform.parent changed, gameObject.name, creating a new game object, etc.

这是transform.parent被改变,gameObject.name,创建一个新的游戏物体,等等。

EditorWindow.OnHierarchyChange 当层级改变

Force Sync with MonoDevelop each time the hierarchy or the project view changes.
每次层级或项目视图改变,MonoDevelop强制同步。

// Simple Editor Script that makes Unity Sync with MonoDevelop each time
// there is a change in the Hierarchy or the Project view.
//在层级或项目视图有改变,使Unity每次MonoDevelop同步

class ForceSync extends EditorWindow {

	@MenuItem("Example/ForceSync When project changes")
	static function Init() {
		var window : ForceSync = EditorWindow.GetWindowWithRect(ForceSync, Rect(0,0,100, 100));
		window.Show();
	}
	function OnGUI() {
		if(GUILayout.Button("Sync now!"))
			EditorApplication.ExecuteMenuItem("Assets/Sync MonoDevelop Project");
	}
	function OnHierarchyChange() {
		EditorApplication.ExecuteMenuItem("Assets/Sync MonoDevelop Project");
		Debug.Log("Sync");
	}
	function OnProjectChange() {
		EditorApplication.ExecuteMenuItem("Assets/Sync MonoDevelop Project");
		Debug.Log("Sync");
	}
}
最后修改:2011年6月24日 Friday 15:11

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。