Search Unity

Question [1.0.0-exp.8] is there a way to specify child entities that should not be synchronized?

Discussion in 'NetCode for ECS' started by sirwhatevers, Oct 21, 2022.

  1. sirwhatevers

    sirwhatevers

    Joined:
    Aug 25, 2017
    Posts:
    33
    For example, I have some text above the player (as a child of the player prefab) that I need to rotate to face the camera. There is no camera for the server, so prediction will always be wrong, nor does it make sense to synchronize presentation-only stuff. Is there a way to turn sync off for specific parts of a prefab? Or is there a better way to do what I'm trying to do?
     
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    Oh yeah, you can customise that behaviour for each individual prefab, by assigning the DontSerializeVariant to the Rotation on the child game you want to exclude.

    However, note that in 1.0-exp.8, by default, we don't serialise components for child entities, so the rotation and translation etc etc are not synchronised.

    To change the behaviour for the prefab, add a GhostAuthoringInspectionComponent to the GameObject you want to customise.
    The replicated components will show in the inspector and you can select for each of them a different variant to use.
     
    sirwhatevers likes this.
  3. sirwhatevers

    sirwhatevers

    Joined:
    Aug 25, 2017
    Posts:
    33
    Any idea what's going on here? It seems the GhostUpdateSystem keeps updating this ghost child entity's rotation to 0, which conflicts with my AimAtMainCameraSystem.

    upload_2022-11-1_11-53-53.png

    upload_2022-11-1_11-54-35.png

    I also couldn't find a way to turn this off in the GhostAuthoringInspectionComponent.
     

    Attached Files:

  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I need to see how you configured the ghost for give some more information
     
  5. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    246
    I have noticed that if you add a GhostAuthoringInpectionComponent to a child of a ghost, the Translation and Rotation are set to their default serializers instead of DontSerializeVariant. This looks like a bug.
     
  6. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    in 1.0-exp.8 they should be set to DontSerializeVariant. Pretty sure in 1.0-exp.13 (latest release) work that way. We ported a couple of fixes for the UI, variant in particular.
     
  7. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    246
    I'm using 1.0-exp.13 and the result is the same
     
  8. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I'm using it right now and I have the correct DontSerialize variant.
    So.. I suppose I'm not trying to do the same thing. I will start a project from scratch, without anything into it, instead of using NetcodeSamples or whatever else.
     
  9. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    I've just found a bug in `DefaultVariantSystemBase` and `DefaultVariantSystemBase.Rule` where `DontSerializeVariant`s are not hashed using the new constant hash. Not sure if related to this, but will try to get that fix backported ASAP.
     
    Occuros likes this.