GetComponent

Can someone please explain to me what does the GetComponet Code does as simple as possible please?

It… Gets a component from the object that you can now store that component as a variable and manipulate it’s values.

For example… If you do a trans = GetComponentTransform>(); this will store trans as the component Transform for the variable. You can now manipulate the object’s position via trans.position = Vector3. You can do this for scripts, an animator, a rigidbody, anything that’s a component of your game object.

Hope that clears things up :slight_smile:

I explain it very clearly here:

and here