public void OnTouchUp(Vector3 point) { GetComponent <SplineController> ().AutoClose = false; GetComponent <SplineController> ().WrapMode = eWrapMode.ONCE; GetComponent <SplineController> ().SplineRoot = SplineHolder; GetComponent <SplineController> ().RestartSpline(SplineHolder.transform.childCount / 3.0f); HoldingPatternHolder.GetComponent <LineRenderer> ().enabled = false; // Detecting if we have finished the line on top of a hangar Ray ray = new Ray(point, new Vector3(0.0f, 0.0f, 1.0f)); RaycastHit touchHit; if (Physics.Raycast(ray, out touchHit, 1000, hangarLayerMask)) { GameObject hangarObject = touchHit.transform.gameObject; Hangar hangarComponent = hangarObject.GetComponent <Hangar>(); Debug.Log("Got the component: " + hangarComponent); hangarComponent.SetPlaneComingToHangar(this.transform.gameObject); //We might have to do more stuff here :D } }