Created
January 29, 2016 10:04
-
-
Save anonymous/3142704c18025f475164 to your computer and use it in GitHub Desktop.
おかしいプレハブを強制的にブレークする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MenuItem("GameObject/Forcely Break Prefab", false, 1)] | |
static void BreakPrefabObject() | |
{ | |
GameObject disconnectingObj = Selection.activeGameObject; | |
Selection.activeGameObject = null; | |
PrefabUtility.DisconnectPrefabInstance(disconnectingObj); | |
UnityEngine.Object prefab = PrefabUtility.CreateEmptyPrefab("Assets/dummy.prefab"); | |
PrefabUtility.ReplacePrefab(disconnectingObj, prefab, ReplacePrefabOptions.ConnectToPrefab); | |
PrefabUtility.DisconnectPrefabInstance(disconnectingObj); | |
AssetDatabase.DeleteAsset("Assets/dummy.prefab"); | |
Selection.activeObject = disconnectingObj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment