- [Voiceover] Now that we've created our test window,…let's take some time to look at the life cycle…of the window itself.…We'll open up our test window in MonoDevelop.…Below the Init method, let's go down and create a new method…that will get triggered whenever the window gets focused.…We'll call this private, it's return type will be void,…and we'll call it OnFocus.…Inside, we'll create a debug log statement…that simply states OnFocus.…Next, let's copy this method and paste it below.…

Here, we're going to change the method…to say OnLostFocus…and we'll change the debug log statement…to OnLostFocus as well.…Now, let's save this and go back into the Unity editor.…We'll open up our console so that we can see these changes.…If we go ahead open up the test window,…you'll see that OnFocus is being called.…If we click outside of the window,…you'll see that LostFocus gets called as well.…If we go back and reopen the window, OnFocus is called.…

Author

Updated

10/3/2016

Released

3/29/2016

Unity is a powerful IDE for 2D and 3D game development. But it's even better when you extend it by building your own custom tools. Join Jesse Freeman, as he explores extending the Unity IDE with custom inspectors, editor windows, and other tools for speeding up game development. Learn how to extend the existing inspector by exposing public fields, build custom editor windows, save and load files to the project folder, and more. Plus, learn how to style and skin your tools so they're easier to use. Want to share your customizations with others? When you're done, you can export the new tools to share with colleagues or sell in the Unity Asset Store.