- Home /
Update function in a UnityScript attached to 50 clones of a prefab: heavy or not?
I'm planning on making a scene with 50 clones of a prefab. This prefab has a Unity Script attached on it. The script contains an Update function. I've read that separate Update functions pose an extra burden to the cpu (each of them I mean). So if I make this scene does it mean that 50 Update functions will be called each frame? Or because the objects are clones of a Prefab the Update function is actually called once each frame?
Answer by Eric5h5 · Jun 10, 2011 at 05:10 PM
It's faster to have a single function that loops through 50 objects, rather than 50 separate functions. But make sure this actually is any kind of bottleneck before reworking code. (e.g., 50 separate functions on a computer--as opposed to mobile device--isn't likely to have any real effect.)
Your answer
![](https://koobas.hobune.stream/wayback/20220612102706im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cloned Prefab 3 Answers
Changing prefab doesn't update instances (in scene aswell as in other prefabs).. 3 Answers
Stop the Update function so death animation can complete. 1 Answer
How do I import packages with Prefabs to Update my package automatically? 1 Answer
Cast Source Instantiating Error 1 Answer