Last active
December 29, 2015 14:49
-
-
Save majecty/7686609 to your computer and use it in GitHub Desktop.
Unity3d Find object using instanceid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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