Created
September 6, 2018 08:48
-
-
Save WikkidEdd/998b59c395717da2dbef4581774f7bff to your computer and use it in GitHub Desktop.
Fully break prefab connection so it can't be reconnected. Just put into an Editor folder and you'll find the menu option "GameObject/Break Prefab Instance Permanently"
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class BreakPrefabPermanently | |
{ | |
[MenuItem("GameObject/Break Prefab Instance Permanently", priority=100)] | |
static void BreakPrefab() | |
{ | |
GameObject prefab = PrefabUtility.CreatePrefab("Assets/BreakPrefab.prefab", Selection.activeGameObject); | |
PrefabUtility.ReplacePrefab(Selection.activeGameObject, prefab, ReplacePrefabOptions.ConnectToPrefab); | |
AssetDatabase.Refresh(); | |
AssetDatabase.DeleteAsset("Assets/BreakPrefab.prefab"); | |
PrefabUtility.DisconnectPrefabInstance(Selection.activeGameObject); | |
} | |
[MenuItem("GameObject/Break Prefab Instance Permanently", validate = true)] | |
static bool BreakPrefabValidate() | |
{ | |
return Selection.activeGameObject; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment