Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ScriptableSingletonを使用したケース
using UnityEngine;
using UnityEditor;
public class EditorWindowParameter : ScriptableSingleton<EditorWindowParameter>
{
public EditorWindowTest window;
public string message;
}
public class EditorWindowTest : EditorWindow
{
[MenuItem("Window/Show")]
static void Init()
{
var instance = EditorWindowParameter.instance;
if (instance.window == null) {
instance.window = EditorWindow.CreateInstance<EditorWindowTest> ();
instance.message = "C";
}
instance.window.Show ();
}
void OnGUI()
{
var instance = EditorWindowParameter.instance;
GUILayout.Label (instance.message);
if (GUILayout.Button ("PUSH")) { instance.message += "#"; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment