private void OnValidate() { if (!rigidbody2D) { rigidbody2D = GetComponent <Rigidbody2D>(); } if (!checkGrounded) { checkGrounded = GetComponent <CheckGrounded>(); } }
// Get the Rigidbody void Start() { script = GetComponent <CheckGrounded>(); rb = GetComponent <Rigidbody>(); }