when i call transform from a script does unity use GetComponent() in the background to get it?

i read a blog claim that when you call transform in the script unity call GetComponent() behind the scene . i thought its a reference unity store it inside MonoBehaviour

If you can remember where that blog is, I’d like to read it because I believe it to be wrong.

For GameObjects, the values of transform are accessed using an internal method, which is quicker than GetComponent. Caching the transform is faster still but not really worth it in the real world. The transform is the only component in a GameObject that has this favourable treatment by Unity because it’s the only one that’s always there. You should always cache components other than transform.

If you want to see some figures, look at this post on the Unity forums by the ever reliable zombiegorilla. Roger Miller has also published some stats which are similar to zombiegorilla’s. There is an advantage to caching transform but, unless you are doing it thousands of times in an update loop, fugeddaboutit…

Although I wouldn’t claim Microsoft are world’s greatest on Unity, they do say this: We recommend caching references to all relevant components and GameObjects at initialization because repeating function calls such as GetComponent() and Camera.main are more expensive relative to the memory cost to store a pointer. Camera.main just uses FindGameObjectsWithTag() underneath, which expensively searches your scene graph for a camera object with the “MainCamera” tag.

But you already knew that ;o)