My question is the one on the title I have a conversation with a friend and he says that every single time the call gameobject.transform is being called is doing a get component() and its expensive performance so thats why is better to store the transform to another variable such Transform m_transform.
For me sounds a bit not very logical to don’t be a stored variable since its a core component of each game object.
I don’t remember exactly, but I believe at one time Unity did that, but doesn’t anymore. But the only way to be sure is to check yourself using the aforementioned tools.
I’ve checked and in Unity 5.4.4 the ‘transform’ property calls the internal C++ implementation, meaning it could either be cached or not cached internally.
There was a similar discussion about a year and a half ago. Using the GameObject’s transform property is faster than using GetComponent() to access it. Caching it yourself rather than using the transform property is even faster but at that point the differences are minor.