Game Development Reference
In-Depth Information
Event/delegate
Description
This event is used to track when a modifier key ( Alt , cmd , Ctrl , and so on) is
pressed. So, you need to change a view when a modifier key is pressed, and you
need to watch for this event/delegate.
modifierKeysChanged
These events can be added to any class/script in your Editor project folder, so you can
hook up a functionality to run when these events occur using the following syntax. For ex-
ample, let's employ the following methods in an editor script to fire whenever we change
the project's hierarchy:
void OnEnable()
{
// Event / delegate registration, usually put in the
OnEnable
//or other function
EditorApplication.hierarchyWindowChanged +=
HierarchyWindowChanged;
}
//callback function for when event occurs
void HierarchyWindowChanged()
{
//Scan hierarchy for new items
//If found add something to the editor window
}
void OnDestroy()
{
// Don't forget to unregister the delegate when it goes
out of
//scope or is not needed
EditorApplication.hierarchyWindowChanged -=
HierarchyWindowChanged;
}
Search WWH ::




Custom Search