Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Are .gameObject and .transform both using GetComponent() in the background?

$
0
0
I know .transform usage should be cached for optimization. I can get around that by directly storing the Transform of the object so I can just say: var myObject : Transform; myObject.position = Vector3.zero; However, if I also need to access the GameObject (in this case, to set it as active/inactive), does using `myObject.gameObject` also use a hidden GetComponent lookup as .transform does, or is .gameObject a special case?

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>