When to handle input

I was wondering if there is any difference/preference in when you handle input (specifically mouse and/or touch inputs, but others as well).

When I say “when” - I mean if I handle the input in OnGUI(), Update() or FixedUpdate()

You need to handle input in Update since the underlying Unity framework keeps track of things like “key down” and “key up” based on frames - i.e. “key down” will be true for a given key until the next frame.

As a result, trying to do input in FixedUpdate can cause missed input since it can run out of phase with Update.

Finally, OnGui can be called multiple times per frame because of how GUI events are handled.