void ScanForInteractiveObject() { Interactive hitObject = null; Vector3 startLocation = this.transform.position; RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, 100f)) { hitObject = hit.collider.GetComponent <Interactive>(); if (hitObject != null) { hitObject.LookedAt("Player is viewing interactive object"); } } }