Search Unity

GhostPrefabRuntimeStrip is added to my ghost prefab entity at runtime on the client side

Discussion in 'NetCode for ECS' started by Campi, Apr 9, 2021.

  1. Campi

    Campi

    Joined:
    Feb 25, 2013
    Posts:
    9
    Hello!
    The documentation says:
    But I don't understand the real meaning, what needs to be stripped off from the ghost at runtime?
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    The client and server uses slightly different version of the prefabs for ghosts. The client has a snapshot history buffer attached to the ghost which the server doesn't have, the server always has a PredictedGhostComponent which the client only has it the ghost is predicted, components are removed from one or the other based on the PrefabType in the GhostComponent attribute. There might be something more I'm forgetting.

    When you build a client only or server only version of the subscene data we remove those component at conversion time - when building your data. If the subscene should work on both the client and the server we cannot do that. What we do instead if flag the prefabs and pre-spawned ghosts as needing to remove those component at runtime based on if the world is a client or server world. We also store lists in a blob asset to tell the runtime which component to remove.