- Home /
Error when init a scriptableWizard
I am trying to create my own ScriptableWizard , I put my code at the folder Assets/Editor , the file name is the same with the class name. But when I open it using a menu item ,I got the error:
Instance of MyScriptableWizard couldn't be created because there is no script with that name.
UnityEditor.ScriptableWizard:DisplayWizard(String, Type)
MyScriptableWizard:CreateWizard() (at Assets/Editor/MyScriptableWizard .cs:24)
Here is code:
using UnityEngine;
using UnityEditor;
using System.Collections;
// A Wizard class that generates it's fields from public properties
public class MyScriptableWizard : ScriptableWizard
{
//---------------------------------
// Reflection Fields
//---------------------------------
// An auto generated field
public string myGeneratedField;
//---------------------------------
// Static Methods
//---------------------------------
// Create the wizard
[MenuItem ("GameObject/Wizards/My Scriptable Wizard")]
static void CreateWizard ()
{
MyScriptableWizard wizard = DisplayWizard<MyScriptableWizard>("My Scriptable Wizard", "Wizard Create", "Wizard Other Button");
}
//==================================
// Messages
//==================================
// Called every frame when the wizard is visible.
void OnDrawGizmos()
{
}
// This is called when the user clicks on the Create button.
void OnWizardCreate()
{
}
// This is called when the wizard is opened or whenever the user
// changes something in the wizard.
void OnWizardUpdate()
{
}
// Allows you to provide an action when the user clicks on the
// other button.
void onWizardOtherButton()
{
}
}
And for me it wasn't working because not in the Editor folder, thanks for pointing it out
Answer by Bunny83 · Jan 05, 2012 at 01:57 PM
Like all Unity derived classes the filename of the script have to match the classname.
MyScriptableWizard.cs
Thanks for your help ,I found there is a space at the last of the class name....
Answer by Chris_Entropy · Feb 08, 2017 at 03:30 PM
Had this error as well. In my case I had tried to display a scriptable wizard derived class, which was marked as "abstract". This is not supported, as it seems (was also not intended by me), but it is not shown properly in the error message.