Is this possible?
I want to have an object created automatically either when the project is opened or the editor switches into play mode (or anywhere in between). This object will have an editor script that monitors certain game objects.
Now I know I can achieve this with an EditorWindow but I will still have to manually open the window via a menu command, and if I dock the window it will fail on closing/reopening the project - plus the window’s update will not always be running.
I could perhaps hook into the EditorApplication.update delegate somwhere, but I still need to explicitly do this - which i want to avoid.
Any solutions?
Not that I know of.
And wouldn’t turning on when hitting play just be the same as selecting some menu entry or something?
Why don’t you want to manually turn it on or off when you start up? Is there a reason this has to be 100% automated?
True, I didn’t consider this. But it would mean changing well established habits. I don’t want myself or my team to have to now think about not pressing play and instead using some other menu command/shortcut. Although, I admit this might be the best way in the absence of something better.
Just for convenience. Basically I don’t want the rest of my team having to remember turn something on each time they open the project.
Clearly, automated is best if it can be done.