Skip to content

Instantly share code, notes, and snippets.

@s2kw
Last active December 12, 2015 10:28
Show Gist options
  • Save s2kw/4758888 to your computer and use it in GitHub Desktop.
Save s2kw/4758888 to your computer and use it in GitHub Desktop.
UnityEditor.EditorWindow Test
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");
}
}
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