Last active
November 29, 2015 20:01
-
-
Save tsubaki/772524faef62621a7c89 to your computer and use it in GitHub Desktop.
ハッシュ値からオブジェクトへPINGする
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 System.Collections; | |
using UnityEditor; | |
public class PingTargetWindow : EditorWindow{ | |
static EditorWindow window; | |
[MenuItem("Window/Ping")] | |
static void Init() | |
{ | |
if( window == null ) | |
window = EditorWindow.CreateInstance<PingTargetWindow> (); | |
window.Show (); | |
} | |
static void Stop() | |
{ | |
EditorApplication.isPaused = true; | |
} | |
string input = string.Empty; | |
int cacheHash = -1; | |
void OnGUI() | |
{ | |
UnityEditor.EditorGUI.BeginChangeCheck (); | |
input = EditorGUILayout.TextField ("instanceID", input); | |
if (EditorGUI.EndChangeCheck ()) { | |
int hash; | |
if (int.TryParse (input, out hash)) { | |
EditorGUIUtility.PingObject (hash); | |
cacheHash = hash; | |
} | |
} | |
EditorGUI.BeginDisabledGroup (cacheHash == -1); | |
if (GUILayout.Button ("PING")) { | |
EditorGUIUtility.PingObject (cacheHash); | |
} | |
EditorGUI.EndDisabledGroup (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment