- Home /
Custom Editor window close event...?
Hey people,can anyone guide me how to fire an event/function when I close my custom editor window.
//Display the Custom Window
CustomWindow window = (CustomWindow ) EditorWindow.GetWindow(typeof(CustomWindow));
window.Init();
The CustomWindow Class should have a function that will be fired when I close this CustomWindow.
Answer by GameVortex · Dec 17, 2013 at 12:58 PM
You can use the callback function **OnDestroy** for that.
No problem, remember to mark the question as answered. =)
ps: OnEnable and OnDisable also exist for Editorwindows. OnEnable should be the preferred way to initialize the window unless your window depends on initialization parameters, in this case i would use an Init function.
I've accepted the answer. Don't forget to upvote the question ;)
Right, I always forget to do that, sorry about that. =)
Your answer
Follow this Question
Related Questions
Unity Editor Event System 1 Answer
Changes to Object made in custom Editor Window don't persist 0 Answers
Keep equal width for panels in EditorGUILayout.HorizontalScope 0 Answers
Execute editor window scripts when project errors are present 0 Answers
Is interraction between EditorWindow and php file possible? 1 Answer