Game Development Reference
In-Depth Information
seo_object.Update();
Waypoint[] waypoints = GetWaypointArray();
sep_waypointCount.intValue = waypoints.Length;
for (int i = 0; i < sep_waypointCount.intValue;
i++) {
SetWaypoint(i,waypoints[i]);
}
seo_object.ApplyModifiedProperties();
}
}
5. Then, we need to go back to the
OnEnable()
function and add one line of code
that will call this function when the
Hierarchy
view has changed. Let's add the
highlighted code as follows:
// Unity JavaScript user:
function OnEnable ()
{
…
EditorApplication.hierarchyWindowChanged =
UpdateHierarchy;
}
// C# user:
void OnEnable ()
{
…
EditorApplication.hierarchyWindowChanged =
UpdateHierarchy;
}
6. Now, let's finish our code. We can go back to the Unity editor and add the
Way-
pointsContainer
script (not the
WaypointsContainerEditor
) to the
WaypointsContainer
object in the
Hierarchy
view. We will see in the fol-
lowing screenshot that the inspector has changed from the way it was: