|
I'd like to run and editor script as soon as Unity launches. The closest I've been able to come is by using a CustomEditor on type Object, which launches as soon as something is selected. Is it possible to run an editor script function when the Unity editor launches?
(comments are locked)
|
|
I have taken the excellent code from the answer pointed to by vitamine and added it to the Community Wiki at http://www.unifycommunity.com/wiki/index.php?title=Autorun . Cheers!
(comments are locked)
|
|
You could try a couple of different methods with OnEnable() (for example, on a class derived from "Editor", or on a custom editor window, or something like that). The only other way I could think of is to have a script with Thanks. I'll have to try the Editor window. Currently, I'm using a class derived from Editor tied to UnityEngine.Object via the CustomEditor command. That runs the OnEnable method as soon as anything in the project or hierarchy is selected (which may be good enough), but not when Unity starts up.
Sep 10 '10 at 04:18 PM
HeywoodFloyd
Did you also try the constructor on the Editor-derived class? That might work, too :P
Sep 10 '10 at 06:50 PM
qJake
I did try the Editor-derived scripts. Their OnEnable methods aren't run until an object for which they're attached via the CustomEditor command is selected. I also tried putting in an internal class whose constructor did what I want, and making a static instance of it. Again, the inner class's constructor wasn't run until an item was selected.
Sep 15 '10 at 06:26 PM
HeywoodFloyd
(comments are locked)
|
