Hi All,
I wanted to get some thoughts or opinions on the following:
Single script with large update
vs.
Many scripts many updates performing the same tasks.
Here is the scenario, let’s say I have one giant Update() in a single script, with very heavy CPU and GPU activity, let’s say 10000 lines of code, with equally heavy cpu/gpu for each line, JUST for this discussion’s purposes. (No, I wouldn’t put 10,000 lines in one script and build an mmo in a Start() function. ) ![]()
Will the resulting application see any benefit if I was to break that script into
100 scripts, with 100 lines of code in each script, equally distributed?
Disregard what the code does, hardware, coding best practices, batching, ease of managing project and anything else. Just consider splitting scripts for app performance, that is all I’m concerned with. Will the app performance be the same since it has to go cyclically though all updates each frame anyway?
I don’t have a firm grasp of anything, so to me it could go both ways:
1- Unity player only has to process only one script per update so that could be faster
or
2-Unity player can process multiple updates() simultaneously hyperthreading cpu/gpu calls or some other wizardry that is beyond me, so splitting it up is better.
Would appreciate any thoughts on this, even a short answer like “2” would be of use to me.
Thanks,
E