ScenePartition/Editor/ScenePartitionMenuEditor.cs
max ddf71ef7d7 GameObject menu copy file Id
- GameObject menu copy file id
2023-07-09 23:00:23 +02:00

29 lines
858 B
C#

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}");
}
}
}
}