- Home /
Can an object script NOT contain Update()?
If I have a GameObject with three scripts attached to it, do all three scripts have to have an Update() function? Can 1, 2 or even all 3 have no Update() at all but just normal called functions, maybe that are called by another script attached to another GameObject?
And if so, does it make any difference? I read somewhere on another forum that for iPhone optimisation, it's better to have one function to affect a whole collection of objects, rather than each of those objects having its own little Update()...
Answer by e-bonneville · Feb 03, 2011 at 09:49 PM
No, none of the scripts on your GameObject have to include an Update() function.
The memory cost for ten Update()'s is really affected by what you do in it. Alone, it's minimal, so I wouldn't worry about it.
I see. Does an empty Update() function actually cost some performance? Over and above a script with lots of called functions but no Update() function? (if I had thousands of instances, for example)
An empty Update() function costs next to nothing, because you're not doing anything to use up memory in it. Even if you did have thousands of instances, the memory use is still tiny and not worth worrying about. ;)
That's not really true; an Update call does have overhead, and should be removed if you're not using it. Thousands of objects with empty Update functions will have a noticeable performance hit an an iPhone (not that you'd want thousands of objects on an iPhone to begin with).
Thanks for clearing that up, Eric. I've not worked with iPhone before, so my experience is solely with high-end platforms. As a result, I don't know a whole lot about iPhone optimization.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102708im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making a GetComponent array 1 Answer
Efficiency of Game Loops 2 Answers
help with iphone 3GS performance (polys and audio) 2 Answers
Large level loading best practices 1 Answer
Colliders vs RayCast (automatic crosshair aiming in an FPS game) 1 Answer