Search Unity

Question InputEvent payload

Discussion in 'NetCode for ECS' started by SchnozzleCat, Nov 27, 2022.

  1. SchnozzleCat

    SchnozzleCat

    Joined:
    Oct 23, 2013
    Posts:
    42
    What is the correct approach to send additional data for an action triggered by an InputEvent?

    It seems more involved than just setting the data on the client and triggering the event, since sometimes the InputEvent will be set on the server, but the sent data will not be the same as the one that was set on the client when the InputEvent was triggered. This is also not the case every time, but will happen quite often.

    The sent data in this case is a guid, and is being read in the PredictedSimulationSystemGroup by the server.
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Hey SC!

    Can you provide a repro project or code snippet for a repro of this, please? Architecturally, this should be impossible (as the entire input struct is serialized at once, in totality). I.e. My understanding is that if you set an InputEvent on the same frame as some other replicated input field, both must be synchronized together.

    It may be because your GUID is a non-standard type. How do you serialize it currently?

    When you say "not the same", what does the guid look like? I.e. Is the guid out of date (old), corrupted, or a default value? Cheers.
     
  3. SchnozzleCat

    SchnozzleCat

    Joined:
    Oct 23, 2013
    Posts:
    42
    I have it set up that the GUID is set to a specific value on the same frame as the ``InputEvent`` on the client, otherwise it is the default value. On the server frame where the ``InputEvent`` has ``IsSet`` as ``true``, the GUID value will sometimes be the default value instead of the value I set it to, as if it was using the data of a different tick.

    The GUID type is just 4 ``uint``s, so I'm not sure if this could be the issue.

    I'll try and make a separate repo project and see if I can replicate it there. Cheers and thanks for the help!