using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; [Serializable] [RequireComponent(typeof(XRSocketInteractor))] public class Inventory : MonoBehaviour { public int slots = 1; private List _inv; private XRSocketInteractor xrSocketInteractor; private void Awake() { xrSocketInteractor = GetComponent(); _inv = new List(slots); var oldestInteractableSelected = xrSocketInteractor.GetOldestInteractableSelected(); xrSocketInteractor.selectEntered.AddListener(Call); xrSocketInteractor.hoverEntered.AddListener(Call); } private void Call(HoverEnterEventArgs arg0) { Debug.Log("hoverenter "+arg0.interactableObject + " " + xrSocketInteractor.hasHover + " " + xrSocketInteractor.hasSelection); } private void Call(SelectEnterEventArgs arg0) { Debug.Log("selectenter "+arg0.interactableObject); } }