private void Start() { try { thisRigidbody = GetComponent <Rigidbody>(); } catch (NullReferenceException) { Debug.LogError("CollisionRecoil: " + gameObject.name + " Rigidbody was not set in the inspector!"); } try { thisFollowObject = GetComponent <BladeFollow>(); } catch (NullReferenceException) { Debug.LogError("CollisionRecoil: " + gameObject.name + " FollowObject was not set in the inspector!"); } try { retrunToBase = GetComponent <ReturnToBase>(); } catch (NullReferenceException) { Debug.LogError("CollisionRecoil: " + gameObject.name + " ReturnToBase was not set in the inspector!"); } }
private void Update() { CountDownTime(); try { followObject = GetComponent <BladeFollow>(); } catch (System.NullReferenceException) { Debug.LogError("ReturnToBase: " + gameObject.name + " FollowObject was not set in the inspector!"); } }