void CheckForInteractable() { Ray _ray = new Ray(m_cam.transform.position, m_cam.transform.forward); RaycastHit _hitInfo; bool _hitSomething = Physics.SphereCast(_ray, raySphereRadius, out _hitInfo, rayDistance, interactableLayer); if (_hitSomething) { InteractableBase _interactable = _hitInfo.transform.GetComponent <InteractableBase>(); if (_interactable != null && !ExamineController.Instance.IsExamine) { if (interactionData.IsEmpty()) { interactionData.Interactable = _interactable; GetItemType(_interactable); } else { if (!interactionData.IsSameInteractable(_interactable)) { interactionData.Interactable = _interactable; GetItemType(_interactable); } } } } else { uiPanel.ResetUI(); interactionData.ResetData(); } Debug.DrawRay(_ray.origin, _ray.direction * rayDistance, _hitSomething ? Color.green : Color.red); }