Ejemplo n.º 1
0
 static void OnPrefabSaving(GameObject go)
 {
     UnityEditor.Experimental.SceneManagement.PrefabStage stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
     if (stage != null)
     {
         UnityEngine.UI.UIManifest manifest = go.GetComponent <UnityEngine.UI.UIManifest>();
         if (manifest != null)
         {
             UIPanelModifier.Refresh(manifest);
         }
     }
 }
Ejemplo n.º 2
0
        static void StartInitializeOnLoadMethod()
        {
#if UNITY_2018_4_OR_NEWER
            // 监听新的Prefab系统
            UnityEditor.Experimental.SceneManagement.PrefabStage.prefabSaving += OnPrefabSaving;
#else
            // 监听Inspector的Apply事件
            PrefabUtility.prefabInstanceUpdated = delegate(GameObject go)
            {
                UIManifest manifest = go.GetComponent <UIManifest>();
                if (manifest != null)
                {
                    UIPanelModifier.Refresh(manifest);
                }
            };
#endif
        }