- Home /
Update functions and performance
What should be and what shouldn't be inside Update() functions?
Since they are called very fast, what are the most thing to avoid inside those functions?
For example, i do have 20 NGUI
Label, and i have to update those label to match some game data.
I'm trying my best to separate game logic from the UI, so it is right to update them in the Update function?
Or should i update them from the Logic code only when i need to update the UI?
This is just an example that i want to be clarified, but the main question is first one.
Personally, I use Update() for everything in our game, but in the documentation it says that we should use FixedUpdate() for the physics. Also, for the gui, some people use OnGui(), but we don't because we are not using Unity's gui system.
Just use some good program$$anonymous$$g practice and avoid doing too much in only one class/script.