public void Reset() { cCS = transform.parent.GetComponent <Scr_Connect_System>(); if (cRB == null) { // If no rigidbody is on this object, check if any parent has one cRB = this.transform.root.GetComponentInChildren <Rigidbody>(); // if there is still no rigidbody then be the rigidbody if (cRB == null) { cRB = this.transform.root.gameObject.AddComponent <Rigidbody>(); } } cMC = this.GetComponent <MeshCollider>(); if (cMC == null) { cMC = this.gameObject.AddComponent <MeshCollider>(); } cMC.convex = true; cSS = this.GetComponent <Scr_Socket_System>(); this.tag = "Grabbable"; }
void Reset() { cCS = transform.parent.GetComponent <Scr_Connect_System>(); if (cRB == null) { cRB = this.transform.root.gameObject.AddComponent <Rigidbody>(); } cMC = this.GetComponent <MeshCollider>(); if (cMC == null) { cMC = this.gameObject.AddComponent <MeshCollider>(); } cMC.convex = true; cSS = this.GetComponent <Scr_Socket_System>(); this.tag = "Grabbable"; }