protected virtual void Awake() { // create empty attach transform if none specified if (m_AttachTransform == null) { var attachGO = new GameObject(string.Format("[{0}] Attach", gameObject.name)); if (attachGO != null) { m_AttachTransform = attachGO.transform; m_AttachTransform.SetParent(transform); attachGO.transform.localPosition = Vector3.zero; attachGO.transform.localRotation = Quaternion.identity; } } // setup interaction manager if (!m_InteractionManager) { m_InteractionManager = FindObjectOfType <XRInteractionManager>(); } if (m_InteractionManager) { RegisterWithInteractionMananger(); } else { Debug.LogWarning("Could not find InteractionManager.", this); } }
XRInteractablesTreeView(XRInteractionManager manager, TreeViewState state, MultiColumnHeader header) : base(state, header) { m_InteractionManager = manager; showBorder = false; rowHeight = k_RowHeight; Reload(); }
void SetupInteractablesTree() { m_InteractionManager = UnityEngine.Object.FindObjectOfType <XRInteractionManager>(); if (m_InteractionManager) { m_InteractablesTree = XRInteractablesTreeView.Create(m_InteractionManager, ref m_InteractablesTreeState, ref m_InteractablesTreeHeaderState); m_InteractablesTree.ExpandAll(); } }
/// <inheritdoc /> protected internal override void OnRegistered(InteractorRegisteredEventArgs args) { base.OnRegistered(args); args.manager.interactableRegistered += OnInteractableRegistered; args.manager.interactableUnregistered += OnInteractableUnregistered; // Attempt to resolve any colliders that entered this trigger while this was not subscribed, // and filter out any targets that were unregistered while this was not subscribed. m_TriggerContactMonitor.interactionManager = args.manager; m_TriggerContactMonitor.ResolveUnassociatedColliders(); XRInteractionManager.RemoveAllUnregistered(args.manager, m_ValidTargets); }
void FindCreateInteractionManager() { if (m_InteractionManager == null) { m_InteractionManager = Object.FindObjectOfType <XRInteractionManager>(); if (m_InteractionManager == null) { var interactionManagerGO = new GameObject("Interaction Manager", typeof(XRInteractionManager)); if (interactionManagerGO) { m_InteractionManager = interactionManagerGO.GetComponent <XRInteractionManager>(); } } } }
/// <summary> /// Removes all the Interactables from the given list that are not being handled by the manager. /// </summary> /// <param name="manager">The Interaction Manager to check registration against.</param> /// <param name="interactables">List of elements that will be filtered to exclude those not registered.</param> /// <returns>Returns the number of elements removed from the list.</returns> /// <remarks> /// Does not modify the manager at all, just the list. /// </remarks> internal static int RemoveAllUnregistered(XRInteractionManager manager, List <XRBaseInteractable> interactables) { var numRemoved = 0; for (var i = interactables.Count - 1; i >= 0; --i) { if (!manager.m_Interactables.IsRegistered(interactables[i])) { interactables.RemoveAt(i); ++numRemoved; } } return(numRemoved); }
void RegisterWithInteractionMananger() { if (m_InteractionManager != m_RegisteredInteractionManager) { if (m_RegisteredInteractionManager != null) { m_RegisteredInteractionManager.UnregisterInteractable(this); m_RegisteredInteractionManager = null; } if (m_InteractionManager) { m_InteractionManager.RegisterInteractable(this); m_RegisteredInteractionManager = m_InteractionManager; } } }
public static XRInteractablesTreeView Create(XRInteractionManager interactionManager, ref TreeViewState treeState, ref MultiColumnHeaderState headerState) { if (treeState == null) { treeState = new TreeViewState(); } var newHeaderState = CreateHeaderState(); if (headerState != null) { MultiColumnHeaderState.OverwriteSerializedFields(headerState, newHeaderState); } headerState = newHeaderState; var header = new MultiColumnHeader(headerState); return(new XRInteractablesTreeView(interactionManager, treeState, header)); }
void RegisterWithInteractionMananger() { if (m_InteractionManager != m_RegisteredInteractionManager) { if (m_RegisteredInteractionManager != null && m_InteractionManager != m_RegisteredInteractionManager) { m_RegisteredInteractionManager.UnregisterInteractor(this); m_RegisteredInteractionManager = null; } if (m_InteractionManager) { m_InteractionManager.RegisterInteractor(this); m_RegisteredInteractionManager = m_InteractionManager; } } if (m_RegisteredInteractionManager != null) { m_RequiresRegistration = false; } }
protected virtual void Awake() { // if we have no colliders, add children colliders if (m_Colliders.Count <= 0) { m_Colliders = new List <Collider>(GetComponentsInChildren <Collider>()); } // setup interaction manager if (!m_InteractionManager) { m_InteractionManager = FindObjectOfType <XRInteractionManager>(); } if (m_InteractionManager) { RegisterWithInteractionMananger(); } else { Debug.LogWarning("Could not find InteractionManager.", this); } }