Example #1
0
        internal static void RevertPrefabRemovedComponent(object userData)
        {
            ObjectInstanceAndSourceInfo info = (ObjectInstanceAndSourceInfo)userData;

            PrefabUtility.RevertRemovedComponent((GameObject)info.instanceObject, (Component)info.correspondingObjectInSource, InteractionMode.UserAction);
            EditorUtility.ForceReloadInspectors();
        }
Example #2
0
        internal static void ApplyPrefabRemovedComponent(object userData)
        {
            ObjectInstanceAndSourceInfo info = (ObjectInstanceAndSourceInfo)userData;
            string path = AssetDatabase.GetAssetPath(info.correspondingObjectInSource);

            if (!PrefabUtility.PromptAndCheckoutPrefabIfNeeded(path, PrefabUtility.SaveVerb.Apply))
            {
                return;
            }
            PrefabUtility.ApplyRemovedComponent((GameObject)info.instanceObject, (Component)info.correspondingObjectInSource, InteractionMode.UserAction);
            EditorUtility.ForceReloadInspectors();
        }