Search Unity

Resolved [1.0.0-exp.15] Prespawned ghost entities can not be immediately despawned using ghost relevancy

Discussion in 'NetCode for ECS' started by Kmsxkuse, Jan 2, 2023.

  1. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Prespawned ghost entities loaded in at startup can not be despawned using the ghost relevancy, neither SetIsRelevant or SetIsIrrelevant, unless a period of time has passed. In my testing, it varies between 3 to 5 seconds after initial startup of the server world. Depending on the client latency and load duration

    Reproduce:

    1. Have a prespawned ghost auto-load in at startup.

    2. Have a ghost relevancy system setting all ghosts to irrelevant.

    3. Expect that the prespawned ghost will disappear from the client hierarchy. This however does not happen.

    4. Now add a 5 second delay to the ghost relevancy system. I.e., if (state.WorldUnmanaged.Time.ElapsedTime < 5f) return;

    5. Notice that after 5 seconds and once the ghost relevancy system starts running, the prespawned ghost disappears as expected.
     
    Last edited: Jan 2, 2023
    ThatDan123 likes this.
  2. ThatDan123

    ThatDan123

    Joined:
    Feb 15, 2020
    Posts:
    11
    Yeah i have the same issue.

    Also happens if that scene entity is relevant for the connection it won't receive ghost field data.
     
  3. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Hey!

    Thanks for the report, we'll dig into this.
    Can I ask what quantity of prespawn ghosts (and non Prespawned ghosts) you're both using? Cheers!
     
    Kmsxkuse likes this.
  4. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Thanks for taking this up.

    I have 1 client ghost and about 30 prespawned plus or minus 5 depending on the location it spawned in.
     
    NikiWalker likes this.
  5. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Update: This appears to be correct behaviour in our internal master branch. I'll grab the pre-release branch now.

    Just to clarify: Prespawned ghosts are Disabled until a snapshot containing them (or containing their deletion) arrives. Are the prespawned ghosts in your hierarchies disabled? They should appear greyed out in the Entities hierarchy, and any individual entity should have the Disabled tag component on it.

    If it is disabled, can I ask why you consider this a bug? If you see them as Enabled, then that 100% is a bug. LMK thoughts.
     
    Kmsxkuse likes this.
  6. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Huh, hrm. Okay, so my custom hybrid linking system had with disabled filter option so it is rendering disabled entities, thus making them appear as if they were fully networked when they're not. The option is so prespawned entities show up in scene view and outside of play mode where all ghosts are disabled. Added in a check for that and everything works now.

    Sorry about that. Bug on my end.
     
  7. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Np at all, glad it's resolved.
     
    Kmsxkuse likes this.