Page 1 of 1

Lua Script Wizard for Custom Editors

Posted: Mon Dec 26, 2016 8:38 am
by Crabman
I'm looking to include the Lua Script Wizard in a custom editor and found this on my search. This class doesn't seem to be a part of the current version anymore, though.

Is there a quick and easy way to add the script wizard to a custom editor or would I have to recreate it myself?

Re: Lua Script Wizard for Custom Editors

Posted: Mon Dec 26, 2016 1:03 pm
by Tony Li
Hi,

It's still there. Make sure you've included the PixelCrushers.DialogueSystem namespace. As a test, you might create C# script files named TestLuaWizard.cs and (in an Editor folder:) TestLuaWizardEditor.cs containing the exact code on the page that you linked.

Re: Lua Script Wizard for Custom Editors

Posted: Mon Dec 26, 2016 6:28 pm
by Crabman
Ok, it seems the problem is trying to access it outside of the Editor folder. When I create the test file within that folder, it works, if I copy it to the place where I store my scripts, it throws an error.

I'm defining the CustomEditor within the class that uses it, as I just want to change the way it shows in the inspector. I'm relatively new to fiddling with custom editors, so is this considered bad practice, do I need to create those scripts in the Editor folder or why isn't it possible to access those classes outside of it?

Re: Lua Script Wizard for Custom Editors

Posted: Mon Dec 26, 2016 8:17 pm
by Tony Li
I'm afraid Editor scripts must be in an Editor folder. You can have as many Editor folders as you want, though. People frequently create an Editor subfolder inside their Scripts folder for editor scripts.

Unity compiles scripts in Editor folders into a separate assembly (DLL) than your regular project assembly. This way they're excluded from builds. When Unity looks for custom editors, it only looks in the editor assembly.

Re: Lua Script Wizard for Custom Editors

Posted: Tue Dec 27, 2016 2:58 am
by Crabman
Makes sense. Thanks for clearing that up.

Re: Lua Script Wizard for Custom Editors

Posted: Tue Dec 27, 2016 8:00 am
by Tony Li
My pleasure!