Game Development Reference
In-Depth Information
(s_arrayData, index)).objectReferenceValue = waypoint;
}
}
void RemoveWaypointAtIndex (int index)
{
int arrayCount = sep_waypointCount.intValue;
for (int i = index; i < arrayCount - 1; i++) {
SetWaypoint (i, GetWaypointAtIndex (i + 1));
}
if (GetWaypointAtIndex(index) != null) {
GameObject go =
GetWaypointAtIndex(index).gameObject;
Undo.DestroyObjectImmediate(go);
}
}
void AddWayPoint (Waypoint waypoint)
{
sep_waypointCount.intValue++;
SetWaypoint (sep_waypointCount.intValue - 1,
waypoint);
}
3. Then, we will add the OnInspectorGUI() function, which acts in a similar
way to the OnGUI() function, but this function updates every time we go to the
inspector. Let's add the following code after the AddWayPoint() function:
// Unity JavaScript user:
function OnInspectorGUI ()
{
if ((targets != null) && (target != null)) {
seo_object.Update ();
sep_showGizmo.boolValue = EditorGUILayout.Toggle
("Show Gizmos", sep_showGizmo.boolValue);
if (sep_showGizmo.boolValue) {
sep_random.boolValue = EditorGUILayout.Toggle
("Random Path", sep_random.boolValue);
}
EditorGUILayout.Slider(sep_radius, 1.0f, 3.0f,
Search WWH ::




Custom Search