Lowering tickrate introduces issues where inputs could be missed
Hey,
FYI to developers (might be worth changing the example projects to include this feature).
FYI to developers (might be worth changing the example projects to include this feature).
Issue:
Button presses that occur between TrueSync tick updates are ignored due to the low tick-rate of TrueSync.Solution:
Capture inputs in Update, with a strategy for overriding, and then reset in OnSyncedInput(). E.g.// In MonoBehaviour.Update. // Joystick can just be called on sync. // OR the button inputs. These will be reset when we commit them in OnSyncedInput(). m_action1 |= Input.GetKey(KeyCode.Space); m_action2 |= Input.GetKey(KeyCode.Space); ... // In TrueSyncBehaviour.OnSyncedInput. // Commit (get left stick in place, as there is no aggregation needed). TrueSyncInput.SetTSVector2(0, new TSVector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));); TrueSyncInput.SetBool(1, m_action1); TrueSyncInput.SetBool(2, m_action2); // Reset. m_action1 = m_action2 = false;This supports GetKeyDown/Up too, obviously.
1
Comments
-
Thanks for sharing knowledge @niki_walker_ubisoft.0