init
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VOID.Editor.Utils
|
||||
{
|
||||
public static class GameObjectExtensions
|
||||
{
|
||||
public static GameObject GetPrefabAsset(this GameObject gameObject)
|
||||
{
|
||||
var prefab = AssetDatabase.IsMainAsset(gameObject) ? gameObject : null;
|
||||
if (prefab == null) prefab = PrefabUtility.GetOutermostPrefabInstanceRoot(gameObject);
|
||||
if (prefab == null) prefab = AssetDatabase.LoadAssetAtPath<GameObject>(PrefabStageUtility.GetPrefabStage(gameObject)?.assetPath);
|
||||
return prefab;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf01bc372a8d48e9b16b33e3bd4c09fe
|
||||
timeCreated: 1716668862
|
||||
Reference in New Issue
Block a user