performance query

im thinking using updates or fixed updates can be juicy if theres a lot of stuff in them as these are checked however many times a second,

so say for instance i have a button that accelerates a bike, runs a sound, an animation, and some other stuff, would it be more effective to have one script in an empty object that basically updates checking if i have pressed a button and when i do a script inside that activates all the other components linked to this button.

or would this cause maybe delay from me hitting the button, enable’ing the other script and then runnning it…

or maybe it would be better to have the script with the update fuction only checking to see if i hit the button and then if i do it runs another function in the script which is my acceleration and so on…

can i have your views on this as i would like to get a head start on saving performance in the long run when more effects, sounds,scripts,objects and so on are added to my overall game.

bare in mind that i am creating my game for the iphone and would like it if possible to be able to run on older gen phones without lag, if not i could always make a less visual effects version for them… i would also like to go onto android but thats another £300 and the phones vary so much i aint guna get into it for a while.

If you’re going to use Unity GUI to draw your button (which makes perfect sense) you will draw the button every frame (which is fine).

If the button is pressed, you will call a function (or functions).

These functions will only get called during the frame the button is pressed.

What they do after that is up to you.

They might change the value of a variable, begin an animation, or play a sound.

They might even change the value of a variable that causes something to happen every frame for a little while.