Game Development Reference
In-Depth Information
AddWayPoint (waypoint);
Undo.RegisterCreatedObjectUndo(go,"AddWaypointButton");
}
seo_object.ApplyModifiedProperties ();
}
}
Here, we have created the boolean properties to toggle the show/hide gizmos
and enabled/disabled a random waypoint and the Slider property to adjust the
waypoint radius, and added a button to add a new waypoint to the scene.
4. Before we finish this step, we need to add the one last function that will make the
update when we remove the waypoint object or create the object in the Hierarchy
view. So, let's add the following function after OnInspectorGUI() :
//Unity JavaScript user:
function UpdateHierarchy ()
{
if ((targets != null) && (target != null)) {
seo_object.Update();
var waypoints : Waypoint[] = GetWaypointArray();
sep_waypointCount.intValue = waypoints.Length;
for (var i : int = 0; i <
sep_waypointCount.intValue; i++) {
Undo.RecordObject(waypoints[i].gameObject,"Update"+i.ToString());
SetWaypoint(i,waypoints[i]);
}
seo_object.ApplyModifiedProperties();
}
}
//C# user:
void UpdateHierarchy ()
{
if ((targets != null) && (target != null)) {
Search WWH ::




Custom Search