概要
using System.Linq;
using UnityEditor;
using UnityEngine;
public static class PrefabInstanceDisconnecter
{
[MenuItem("Tools/Prefab/Disconnect")]
public static void Disconnect()
{
foreach (var n in Selection.gameObjects)
{
PrefabUtility.DisconnectPrefabInstance(n);
}
}
[MenuItem("Tools/Prefab/Disconnect All")]
public static void DisconnectAll()
{
foreach (var n in Resources.FindObjectsOfTypeAll(typeof(GameObject)).Where(c => ((GameObject)c).activeInHierarchy))
{
PrefabUtility.DisconnectPrefabInstance(n);
}
}
}
関連記事