Input handling

We have realized that the only way to handle input is to do so in the player prefab.
To us this feels awkward. The player prefab is instantiated, one instance per player but the OnSyncedInput is only invoked on the local player (obviously), so basically we have numPlayers - 1 garbage instances.

We would much prefer to be able to assign a class instance or delegate to be the input handler and have TrueSync call that each synced input.

Best Answer

Answers

  • I am not sure if this is will work for you. I use a spawn manager prefab and pass that through TrueSyncManager. That has most of my input handling in it. (I mostly use AI then, I don't have any input handling on my player prefab) I don't see why you couldn't have an input class at that point and use the gameObject.GetCompent and get your player prefab. I am not an expert on TrueSync and I could be missing something.