- Home /
iPhone / iPad touchscreen input in update or fixedupdate?
Quite a simple question but can't seem to find a solid answer.
Should touchscreen input (virtual buttons and swipes and other gestures) be called in Update or FixedUpdate?
Answer by ScroodgeM · Jul 22, 2012 at 08:04 AM
All inputs should be called in Update functions
FixedUpdate must be used for game physics only
Thanks for the reply Scroodge$$anonymous$$. Although I'm curious, wouldn't the precision of touchscreen gesturing, especially in regard to the speed of the player's finger movement, be better to gather in FixedUpdate, rather than in Update?
FixedUpdate() will not let you get more precision for Inputs since Input updates every Update()
to get speed of finger movement just divide movement offset since last Update() by Time.deltaTime
Ahh, that makes more sense. Thanks Scroodge$$anonymous$$!
Thanks. Update for input, and FixedUpdate for physics. But what if physics is continuously updated based on input? Let's say if a finger is keeping touching the screen and based on its position some physical effect is calculated and applied to the game world? Where to put such?
@rawmantick here is a great example for your question: Getting Your Input To Work Properly. I hope it helps.