ScenePartition/Editor/ScenePartitionMenuEditor.cs

29 lines
858 B
C#
Raw Normal View History

using UnityEditor;
using UnityEngine;
namespace VertexColor.ScenePartition.Editor
{
public static class ScenePartitionMenuEditor
{
[MenuItem("GameObject/CopyFileId", false, 10000)]
public static void CreateTextArea5()
{
GameObject go = Selection.activeGameObject;
if (go == null) return;
GlobalObjectId id = GlobalObjectId.GetGlobalObjectIdSlow(go);
if (id.targetPrefabId == 0) // 0 = no prefab.
{
EditorGUIUtility.systemCopyBuffer = id.targetObjectId.ToString();
Debug.Log($"object id: {id.targetObjectId}");
}
else
{
EditorGUIUtility.systemCopyBuffer = id.targetPrefabId.ToString();
Debug.Log($"object id: {id.targetPrefabId}");
}
}
}
}