코딩하는 나귀

using System.Reflection;
using using UnityEditor;

public int GetLocalIdentifierInFile(UnityEngine.Object obj) {
#if UNITY_EDITOR

        PropertyInfo inspectorModeInfo = typeof(SerializedObject).GetProperty("inspectorMode", BindingFlags.NonPublic | BindingFlags.Instance);

        SerializedObject serializedObject = new SerializedObject(obj);

        inspectorModeInfo.SetValue(serializedObject, InspectorMode.Debug, null);

        SerializedProperty localIdProp = serializedObject.FindProperty("m_LocalIdentfierInFile");

        return localIdProp.intValue;
#else
	    return -1;
#endif
}