I’m experiencing the following error in Unity 6.0, when I join a hosted game (the hosting instance of the game is just fine) when loading the game scene from another menu scene:
The ghost collection contains a ghost which does not have a valid prefab on the client! Ghost: ‘’ (‘ENTITY_NOT_FOUND’).
My game scene is dead simple:
‘GameSetup’ is the Authoring part of the FPS character controller netcode tutorial.
When using the automatic ClientServerBootstrap, and when hosting a game (Client + Server Worlds running in one game instance), the character and player entities spawn and I can move around the game world successfully, both in editor and in a build.
But when I arrive into the game scene from my Main Menu scene, as a client, I get those Ghost Collection errors:
I’m guessing that the two entities not found are the FirstPersonCharacter and FirstPersonPlayer entities the authoring script ought to handle. I guess that because those are the only two entities in the game, I don’t think it can be anything else.
Why is it failing on the client? Why does the Ghost Collection not have valid prefabs when coming in from the other scene?
My scripts for joining/hosting the game are also straight from the Entities For Netcode tutorial:
// In both HostGame and JoinGame address is an endpoint like "192.168.1.1"
public static void HostGame(string address) {
DestroyLocalSimulationWorld();
var server = FrontendBootstrap.CreateServerWorld("ServerWorld");
var client = FrontendBootstrap.CreateClientWorld("ClientWorld");
if (World.DefaultGameObjectInjectionWorld == null)
World.DefaultGameObjectInjectionWorld = server;
SceneManager.LoadSceneAsync("Alt", LoadSceneMode.Single);
NetworkEndpoint.TryParse(address, 13131, out NetworkEndpoint e);
{
using var query = server.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
query.GetSingletonRW<NetworkStreamDriver>().ValueRW.Listen(e);
}
{
using var query = client.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
query.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(client.EntityManager, e);
}
}
public static void JoinGame(string address) {
DestroyLocalSimulationWorld();
var client = FrontendBootstrap.CreateClientWorld("ClientWorld");
if (World.DefaultGameObjectInjectionWorld == null)
World.DefaultGameObjectInjectionWorld = client;
SceneManager.LoadSceneAsync("Alt", LoadSceneMode.Single);
NetworkEndpoint.TryParse(address, 13131, out NetworkEndpoint e);
{
using var query = client.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
query.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(client.EntityManager, e);
}
}
Nothing exotic there, I’m sure you’ll agree.
What’s going on here?