private void UpdateChildrenExits() { foreach (Selectable sel in hierarchyNavigationElements) { HierarchyNavigationElement ele = sel.GetComponent <HierarchyNavigationElement>(); if (ele != null && !ele.OverrideExitTarget) { ele.exitTarget = childrenExitTarget; } } }
public override void OnInspectorGUI() { HierarchyNavigationElement myTarget = (HierarchyNavigationElement)target; myTarget.OverrideExitTarget = EditorGUILayout.Toggle("Override Exit Target", myTarget.OverrideExitTarget); myTarget.OverrideNextTarget = EditorGUILayout.Toggle("Override Next Target", myTarget.OverrideNextTarget); myTarget.OverridePreviousTarget = EditorGUILayout.Toggle("Override Previous Target", myTarget.OverridePreviousTarget); if (myTarget.OverrideExitTarget) { myTarget.exitTarget = (Selectable)EditorGUILayout.ObjectField("Exit Target", myTarget.exitTarget, typeof(Selectable), false); } if (myTarget.OverrideNextTarget) { myTarget.nextTarget = (Selectable)EditorGUILayout.ObjectField("Next Target", myTarget.nextTarget, typeof(Selectable), false); } if (myTarget.OverridePreviousTarget) { myTarget.previousTarget = (Selectable)EditorGUILayout.ObjectField("Previous Target", myTarget.previousTarget, typeof(Selectable), false); } }
public void OrganizeHierarchyNavigation() { for (int i = 0; i < hierarchyNavigationElements.Count; i++) { HierarchyNavigationElement ele = hierarchyNavigationElements[i].GetComponent <HierarchyNavigationElement>(); Navigation nav = new Navigation(); nav.mode = Navigation.Mode.Explicit; if (i + 1 < hierarchyNavigationElements.Count) { if (mode == Mode.Vertical) { if (ele.OverrideNextTarget) { nav.selectOnDown = ele.nextTarget; } else { nav.selectOnDown = hierarchyNavigationElements[i + 1]; } } else if (ele.OverrideNextTarget) { nav.selectOnRight = ele.nextTarget; } else { nav.selectOnRight = hierarchyNavigationElements[i + 1]; } } if (i > 0) { if (mode == Mode.Vertical) { if (ele.OverridePreviousTarget) { nav.selectOnUp = ele.previousTarget; } else { nav.selectOnUp = hierarchyNavigationElements[i - 1]; } } else if (ele.OverridePreviousTarget) { nav.selectOnLeft = ele.previousTarget; } else { nav.selectOnLeft = hierarchyNavigationElements[i - 1]; } } if (i == 0) { if (mode == Mode.Vertical) { if (ele.OverridePreviousTarget) { nav.selectOnUp = ele.previousTarget; } if (ele.OverrideNextTarget) { nav.selectOnDown = ele.nextTarget; } } else { if (ele.OverridePreviousTarget) { nav.selectOnLeft = ele.previousTarget; } if (ele.OverrideNextTarget) { nav.selectOnRight = ele.nextTarget; } } } hierarchyNavigationElements[i].navigation = nav; } }