GameObject menu copy file Id

- GameObject menu copy file id
This commit is contained in:
max 2023-07-09 23:00:23 +02:00
parent 41df190afb
commit ddf71ef7d7
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,29 @@
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}");
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab63a69b46a3ff4438723520d0656c93
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: