Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved The ghost collection contains a ghost which does not have a valid prefab on the client

Discussion in 'NetCode for ECS' started by optimise, Dec 15, 2021.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,135
    @CMarastoni @timjohansson Today I start to get this error "The ghost collection contains a ghost which does not have a valid prefab on the client" at Android build but I have no idea why I get this and the solution to solve it. The game become totally not playable. It seems like dots netcode failed to save valid hash into ghost collection I dunno. Can u fix it and send me unofficial fix?

    The ghost collection contains a ghost which does not have a valid prefab on the client
    UnityEngine.Debug:LogError (object)
    Unity.NetCode.NetDebug:LogError (Unity.Collections.FixedString512&) (at C:/Project/Library/PackageCache/com.unity.netcode@1d20d2a275/Runtime/NetDebug.cs:181)
    Unity.NetCode.GhostCollectionSystem:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.netcode@1d20d2a275/Runtime/Snapshot/GhostCollectionSystem.cs:340)
    Unity.Entities.SystemBase:Update () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/SystemBase.cs:400)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:461)
    Unity.Entities.ComponentSystemGroup:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:406)
    Unity.Entities.ComponentSystem:Update () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystem.cs:114)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:461)
    Unity.Entities.ComponentSystemGroup:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:406)
    Unity.NetCode.ClientSimulationSystemGroup:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.netcode@1d20d2a275/Runtime/ClientServerWorld/ClientSimulationSystemGroup.cs:90)
    Unity.Entities.ComponentSystem:Update () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystem.cs:114)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:461)
    Unity.Entities.ComponentSystemGroup:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:406)
    Unity.Entities.ComponentSystem:Update () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystem.cs:114)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:461)
    Unity.Entities.ComponentSystemGroup:OnUpdate () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystemGroup.cs:406)
    Unity.Entities.ComponentSystem:Update () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ComponentSystem.cs:114)
    Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at C:/Project/Library/PackageCache/com.unity.entities@f64d62e527/Unity.Entities/ScriptBehaviourUpdateOrder.cs:301)
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    The most common cause for this is going in-game on the client before the prefab has been loaded. The behavior of subscene streaming is different in editor and players - so it is common that this only happens in players since streaming in the subscene with prefab data takes longer which lets the systems run before that is done.

    If you have a system on the client which automatically adds the in-game component you have to make sure it has a RequireForUpdate on something inside the subscene containing the prefabs (assuming you are using subscenes)