- Home /
Possible to execute a script before Editor close?
Hi, I need to call a script just before the UnityEditor shuts down (File/Exit or [x]). Is it possible?
Thx, chi
if you have a editor window you can make use of OnDestory.
if it is a script that should run on exit, I am not sure. $$anonymous$$ay be you can try overriding the normal exit functionality with your own menu command.
Answer by thef1chesser · Nov 11, 2013 at 09:57 AM
OnApplicationQuit()
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnApplicationQuit.html
Answer by chi · Nov 11, 2013 at 10:13 AM
Thank you! But OnApplicationQuit() doesn't work for me... I need to call an editor script (setting the EditorFrefs) when the user decides to close the UnityEditor completely... Something like [InitializeOnLoad] just the other way around ;)
In general you create a .exe or something and users don't use Unity3D to run your application.
So how does your application work?
@thef1chesser, he is asking about Editor script that does something smiliar to OnApplicationQuit() function.
I´m working on a editor extension that needs to be set (from a script) to "$$anonymous$$onoDevelop (build-in)" under Preferences/External Tools/External Script Editor if its Unity <= 4.2 or to "$$anonymous$$y Program" if Unity >= 4.3 was detected. What I´m trying to achieve is to set "$$anonymous$$y Program" as the default external script editor every time I close Unity!
Your answer
Follow this Question
Related Questions
Perform action on save/load in editor 2 Answers
Custom Asset Icons? 2 Answers
Editor script - any callback when target is first instantiated? 1 Answer