since:
Transform myTransform = transform;
is apparently faster according to this: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Performance_Optimization.html
Would anyone be able to explain why?
I hear that it is because it saves Unity having to look up the reference to the transform each frame, like:
Transform myTransform = GetComponent<Transform>();
but since:
transform
is not a method and:
GetComponent<Transform>()
is a method, then transform should already be a field which is a pre-defined reference to the Transform on the given GameObject.
Therefore:
Transform myTransform = transform;
is surely redundant code?