コード例 #1
0
    static void OnPrefabSaving(GameObject go)
    {
        PrefabStage stage = PrefabStageUtility.GetCurrentPrefabStage();

        if (stage != null)
        {
            UIManifest manifest = go.GetComponent <UIManifest>();
            if (manifest != null)
            {
                manifest.Refresh();
            }
        }
    }
コード例 #2
0
    static void StartInitializeOnLoadMethod()
    {
        // 监听Inspector的Apply事件
        PrefabUtility.prefabInstanceUpdated = delegate(GameObject go)
        {
            UIManifest manifest = go.GetComponent <UIManifest>();
            if (manifest != null)
            {
                manifest.Refresh();
            }
        };

#if UNITY_2018_4_OR_NEWER
        // 监听新的Prefab系统
        PrefabStage.prefabSaving += OnPrefabSaving;
#endif
    }