RTS Problem

when using OnSyncedInput() i get a problem when trying to use other variables from my game, like if i want to send units to a game objects position then i'll need to use that game object variable in the script.

I keep getting an reoccurring error when running the game not an error that stops you playing the game.

I've tried debugging it and get some funny results, when debugging an integer in OnSyncedInput() it'll debug the correct value but then debug it again (seems like its running twice per frame) with the value at 0 and give me a null error and then the next frame will be the same, the correct value and then a 0 value and another null

Could someone please try and explain this to me? it seems like a bug but any help would be appreciated

also when i get these errors it seems to stop my OnSyncedUpdate () from working.


  • Just been playing with it some more and i also get errors when calling
    if (TrueSyncInput.HasFP (0)) {}

    and OnSyncedStart is also called constantly like an update instead of just once

    Think I'm going to have to wait until an update
  • We'll check if we can reproduce what you just reported, but in the meanwhile I have a suggestion:
    you don't need to send a unit ID as input... send where the user clicked...:) or which button he pressed... This is how a lockstep system works... send the actual user input, and let the deterministic code create a perfectly synced simulation.
  • Hi erickpassos,
    Thanks for your reply,

    Thanks for your suggestion i have tried very similar things, for example i only want selected units to move so i have an 'If' statement saying if the unit is selected or not inside the OnSyncedInput() but again when i try to use my own variables within OnSyncedInput() i get errors when the game is playing

    This makes it very tricky, hopefully this can be fixed on a near update
  • Again,

    I suggest you forget about the units, and just send the "square" the player selected as input (4 FP numbers for the world positions of the corners of the selected area). Let the local clients do the selection itself, it will be exactly the same in all of them...:)