Version: 2017.1

EditorWindow.OnProjectChange()

Cambiar al Manual

Descripción

Called whenever the project has changed.

Typically after import, file moves, etc.


Force Sync with MonoDevelop each time the hierarchy or the project view changes.

// Simple Editor Script that makes Unity Sync with MonoDevelop each time
// there is a change in the Hierarchy or the Project view.

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"); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961