Last active
December 12, 2015 10:28
-
-
Save s2kw/4758888 to your computer and use it in GitHub Desktop.
UnityEditor.EditorWindow Test
This file contains hidden or 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 SubWindow: EditorWindow | |
{ | |
public static SubWindow WillAppear(){ | |
SubWindow window = (SubWindow)EditorWindow.GetWindow<SubWindow>(typeof(SubWindow)); | |
window.minSize = new Vector2(50f,100f); | |
window.title = "SubWindow"; | |
return window; | |
} | |
void OnGUI(){ | |
GUILayout.Label("SubWindow Here"); | |
} | |
} |
This file contains hidden or 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; | |
using System.Collections.Generic; | |
public class TestEditorWindow : EditorWindow { | |
private int num = 0; | |
private SubWindow subWindow; | |
[UnityEditor.MenuItem("Custom/OHGAKI/EdtiorTest")] | |
static void abcde(){ | |
TestEditorWindow window = EditorWindow.GetWindow<TestEditorWindow> (typeof(TestEditorWindow)); | |
window.minSize = new Vector2(300f,300f); | |
window.title = "org editor"; | |
window.position = new Rect(300f,300f,300f,300f); | |
GUIContent content = new GUIContent("__abcde__"); | |
window.ShowNotification(content); | |
} | |
void OnGUI(){ | |
if(GUILayout.Button("button"+num)){ | |
ButtonPushed(); | |
} | |
} | |
void ButtonPushed(){ | |
++num; | |
subWindow = SubWindow.WillAppear(); | |
} | |
//On | |
// void OnSelectionChange(){ | |
// foreach(int a in Selection.instanceIDs ){ | |
// Debug.Log("id = "+ a); | |
// } | |
// } | |
// | |
// void OnFocus(){ | |
// Debug.Log("OnFocus"); | |
// } | |
// void OnLostFocus(){ | |
// Debug.Log("OnLostFocus"); | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment