Skip to content

Instantly share code, notes, and snippets.

@majecty
Last active December 29, 2015 14:49
Show Gist options
  • Save majecty/7686609 to your computer and use it in GitHub Desktop.
Save majecty/7686609 to your computer and use it in GitHub Desktop.
Unity3d Find object using instanceid
using UnityEngine;
using UnityEditor;
using System.Collections;
public class IdentifierToObject : EditorWindow
{
[MenuItem("DEBUG/IdentifierToObject")]
static void ShowWindow()
{
EditorWindow.GetWindow(typeof(IdentifierToObject));
}
string identifier = string.Empty;
Object findedObject = null;
public void OnGUI()
{
identifier = GUILayout.TextField(identifier);
findedObject = (Object)EditorGUILayout.ObjectField(findedObject, typeof(Object));
if (GUILayout.Button("Find"))
{
findedObject = (Object)EditorUtility.InstanceIDToObject(int.Parse(identifier));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment