Skip to content

Instantly share code, notes, and snippets.

@simonwittber
Last active February 12, 2019 11:34
Show Gist options
  • Save simonwittber/60a50efc7813a6a0576c569a1c5cbd6c to your computer and use it in GitHub Desktop.
Save simonwittber/60a50efc7813a6a0576c569a1c5cbd6c to your computer and use it in GitHub Desktop.
Using Unity's ScriptableWizards as Dialogs in CustomEditors.
public class AddThingToSomeScriptableObject : ScriptableWizard
{
internal SomeScriptableObject someScriptableObject;
public SomeThing someThing;
void OnCreateButton()
{
//add someThing to someScriptableObject.
}
}
[CustomEditor(typeof(SomeScriptableObject))]
public class SomeScriptableObjectEditor : Editor
{
public override void OnInspectorGUI()
{
var someScriptableObject = target as SomeScriptableObject;
if (GUILayout.Button("Add a New Thing"))
{
var wizard = ScriptableWizard.DisplayWizard<AddThingToSomeScriptableObject>("New Thing", "Create");
wizard.someScriptableObject = someScriptableObject;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment