# Unity transform  caching

**URL:** <https://discussions.unity.com/t/unity-transform-caching/531109>\
**Category:** Scripting\
**Tags:** Scripting\
**Created:** [March 6, 2014, 3:48pm UTC](https://discussions.unity.com/t/unity-transform-caching/531109 "2014-03-06T15:48:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![McTomas](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/mctomas/32/906890_2.png) [@McTomas](https://discussions.unity.com/u/McTomas)\
**Post date:** [March 6, 2014, 3:48pm UTC](https://discussions.unity.com/t/unity-transform-caching/531109/1 "2014-03-06T15:48:46Z")

</div>

Hi,

I’ve been using Unity for quite sometime and always have been using \_cachedTransform to save locally my object transform because I’ve always been told that it’s more efficient and improves performance because (from what I googled) when you do game object.transform it will actually call game object.GetCompoment().

Unity 3D is now a more stronger and improved tool than before so for me it is really strange that something so basic and important on the development of a game as translating an object, doesn’t have this optimised to have the transform variable a local variable from MonoBehavior that calls GetComponent() on Start (basically what is done to save performance).

So my question is: Is still wise to use cached transform to improve performance? Why haven’t Unity development team improved this from their updates?

---

<div class="post-metadata">

**Author:** ![Eric5h5](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/eric5h5/32/44225_2.png) [@Eric5h5](https://discussions.unity.com/u/Eric5h5)\
**Post date:** [March 6, 2014, 8:25pm UTC](https://discussions.unity.com/t/unity-transform-caching/531109/2 "2014-03-06T20:25:10Z")

</div>

> [@McTomas](#):
>
> when you do game object.transform it will actually call game object.GetCompoment().

No, it’s cached, though not quite as efficiently compared to caching it yourself. It’s unlikely to make any real difference whether you use .transform or a manually cached version, however (or for that matter, using GetComponent(Transform), which is not as “slow” as the common opinion seems to be).

–Eric
