Game Development Reference
In-Depth Information
It is recommended that you combine the use of the [InitialiseOnLoad] attribute to-
gether with a static constructor to ensure the script will run before any other scripts in the
scene or project.
Tip
If you are loading resources in an [InitialiseOnLoad] class, beware that the
filesystem may not be initialized when the script starts. It's recommended you delay it un-
til the first editor update (using the following method). For more details, check out the de-
tailed post at http://bit.ly/InitiliseOnLoadResources .
The EditorApplication callbacks
The editor, like a lot of things in Unity, also comes adorned with several callbacks to mark
when things happen. Exposed through the EditorApplication class, you can gain
access to the following events:
Event/delegate
Description
This event is called every time the editor window is updated or refreshed. Note
that this is more often that the game or scene update calls.
Update
This event is called for each project item in view of the Project window when it
is drawn to the screen.
projectWindowItemOnGUI
hierarchyWindowItemOnGUI This event is called for each item in the Hierarchy window when it is drawn to
the screen.
projectWindowChanged
This event is called whenever an item is changed in the Project window.
hierarchyWindowChanged This event is called whenever an item is changed in the Hierarchy window.
playmodeStateChanged
This event is called when you start or stop the game in the editor.
This event is called whenever the search criteria is changed in any Editor win-
dow.
searchChanged
Search WWH ::




Custom Search