- The RequireComponent attribute automatically adds the required components as dependencies.
- Add the "RequireComponent" will automatically add the script to your gameobject for you.
- This is useful to avoid setup errors.
Example :-
- There is script that use rigidbody component you can write a below
- This will add rigidbody automatically to the gameobject the script attached to gameobject.