Question About 'Accessing' Rigidbody in a Script

When posting code to the forum, make sure to use Code Tags so people can read your code easily.

It’s just a getter method to return a reference to the Component. Not every MonoBehavior will have a Rigidbody2D, so there’s no reason to have a dedicated property for it. Every MonoBehavior has a gameObject and a transform though, which is why you can just get those by accessing them directly.

GetComponent is also pretty scalable, as it will also allow you to get components you create as well. If you wrote a script, you could call GetComponent<YourScriptName>() and it would retrieve it for you.