} //update close private void defaultMode() { //if something is hit in layer default within range if (CastRay.Shoot(this.GetComponent <Camera>(), defaultLayer, shootRange)) { //if that hit object is Interactive, show subtext & check if can be used. if (CastRay.detected.GetComponent <IsInteractive>() != null) { IsInteractive usableObject = CastRay.detected.GetComponent <IsInteractive>(); MasterScript.toast(usableObject.displayText); //if that object is usable- turn on crosshair and on pressing E run doStuff(). if (usableObject.canBeUsed) { MasterScript.EnableCrosshairAll(); if (Input.GetKeyDown(KeyCode.E)) { IsInteractive.doStuff(); } } else { MasterScript.EnableCrosshairRed(); } } else //and if that hit object is not Interactive. { MasterScript.inactive(); } } //shoot close else //if nothing is hit { MasterScript.inactive(); } }