OnSyncedInput

Hi

I am currently prototyping a simple multiplayer RTS/Tower Defense game and decided to test out TrueSync as the game will be geared for 1v1 games.

I am still figuring out the API, however one thing I came across is that only Prefabs/Components that are attached to the TrueSyncManager as player prefabs in the game scene will only receive OnSyncedInput been called?

When I spawn new units via SyncedInstantiate(), I find that OnSyncedUpdate is called, but not OnSyncedInput() - unless I am doing something incorrect in my instantiation.

For my game, I would like to individually give input commands to each new spawned unit rather doing through an "InputManager" and then route the info accordingly.

Is there anyway of providing dynamic created objects to receive inputs?

Thanks

Comments

  • Yes it is possible, but I don't know if will fit to you, I will explain. All input generated belongs to some player in the game, so if you have two units A and B, both generating an input with key "Same_Key" this key will be overridden, the player works like an "input manager". To solve this you could use different keys for each unit, following the example above the keys could be "Same_Key_For_A" and "Same_Key_For_B".

    And to enable a instantiated unit to receive inputs you have to attach an owner to it, you see a example of this in the "SimpleControl.cs" file.