public void ReplaceCarScripts() { print("resetting car"); if (carAlignScript == null) { carAlignScript = this.gameObject.AddComponent <CarAlignToBezier>(); SetAlignScriptToInit(); } if (carFollowScript == null) { carFollowScript = this.gameObject.AddComponent <CarFollowBezier>(); SetFollowScriptToInit(); } if (rb == null) { rb = this.gameObject.AddComponent <Rigidbody>(); SetRigidBodyVariables(); } }
private void Awake() { carAlignScript = GetComponent <CarAlignToBezier>(); carFollowScript = GetComponent <CarFollowBezier>(); rb = GetComponent <Rigidbody>(); }