Search Unity

Feedback IEnableableInputComponentData

Discussion in 'NetCode for ECS' started by RamType0, Dec 23, 2022.

  1. RamType0

    RamType0

    Joined:
    Sep 11, 2018
    Posts:
    67
    We sometimes get optional input data from clients.
    Such as body tracking data.
    In this case, we want to
    - Play animations for clients which doesn't provide tracking data.
    - Apply tracking data for clients which provides tracking data.

    Then, we want to distinguish them by whether the tracking data component is enabled.
     
  2. RamType0

    RamType0

    Joined:
    Sep 11, 2018
    Posts:
    67
    Also, we could reduce network bandwidth usage with this.
    We don't need to send disabled input data.
     
  3. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    Hey RamType0!

    Use `AutoCommandTarget.Enabled` for this.
    • If true, the user is providing tracking data.
    • If false, they are not.
    Component that automates command "reading and sending" (for clients) or "writing, using, and broadcasting" (for the server). When the AutoCommandTarget component is Enabled, the entity is considered as an input source for ICommandData's for the client and all non empty command buffers present on the entity are serialized into the OutgoingCommandDataStreamBufferComponent, along with the id of the ghost they are sent to.

    On the server side, when a command is deserialized from the IncomingCommandDataStreamBufferComponent, the corresponding entity is looked up, and if the AutoCommandTarget component is enabled, the commands are added to the corresponding input command buffer.

    Remarks: To use the AutoCommandTarget, the target entity must have a GhostOwnerComponent.
     
  4. RamType0

    RamType0

    Joined:
    Sep 11, 2018
    Posts:
    67
    IMHO, disabling AutoCommandTarget just stop sending commands to server, and the server uses latest input from clients even after we stop sending commands, isn't it?

    Also, AutoCommandTarget works per instantiated ghost prefab.
    So we cannot disable some of InputComponentData and enable some of InputComponentData of same ghost.