Hi,
I’m using Netcode for Entities with Unity 6 and having trouble with prespawned ghost entities not activating. I have a hub scene that runs a script to initialize the network setup if the game isn’t already in a network session, (which only happens when entering playmode in the editor). The script also references a subscene containing spawn position ghosts and dynamically loads it into both the server and client worlds.
The problem is that all the spawn position ghosts remain disabled and have the Disabled tag. According to the documentation, the SceneSection entity for the subscene should have a PrespawnsSceneInitialized component after the baseline is calculated and the scene load is completed, but this component is completely missing. If I understand correctly, the lack of the PrespawnsSceneInitialized component suggests this process isn’t completing, but I don’t see a clear way to check whether the baseline calculation happened or if something is failing silently during initialization.
I’ve re-checked the subscene setup, ensured the ghosts are valid prefabs with unique transforms, and re-baked the subscene multiple times after making changes. The subscene appears to load properly into both worlds, and I don’t see any CRC mismatch errors or other network-related logs.
Any advice or ideas for debugging this issue would be greatly appreciated.
Server World
Client World
Subscene
The code that load the hub subscene.
using Baracuda.Native;
using Baracuda.Tungsten.Network;
using Baracuda.Tungsten.UI;
using Baracuda.Utility.PlayerLoop;
using Baracuda.Utility.Services;
using Cysharp.Threading.Tasks;
using Unity.Scenes;
using UnityEngine;
namespace Baracuda.Tungsten.Game
{
[AddComponentMenu("Scene/Hub Scene Installer")]
public class HubSceneInstaller : MonoBehaviour, ISceneInstaller
{
[SerializeField] private SubScene entitiesScene;
private void Start()
{
InstallSceneAsync().Forget();
}
public async UniTask InstallSceneAsync()
{
var lobbySystem = ServiceLocator.Get<LobbyManager>();
if (lobbySystem.IsLobbyActive is false)
{
// This will create a lobby which will create a network session if we enter playmode in editor.
await lobbySystem.CreateLobbyAsync();
}
// This gets Server, Client and ThinClient worlds.
using var worlds = WorldUtility.NetworkWorlds;
// Entities scene contains pre spawned ghosts.
var entitiesSceneId = entitiesScene.SceneGUID;
foreach (var world in worlds)
{
var worldUnmanaged = world.Unmanaged;
var sceneLoad = SceneSystem.LoadSceneAsync(worldUnmanaged, entitiesSceneId);
await EntityUtility.WaitForSceneLoadAsync(worldUnmanaged, sceneLoad);
}
Debug.Log("Hub Scene Initialized");
}
}
}
My goal is to have spawn positions in my hub as ghosts so the server can use them to spawn players, and clients can render them for debugging. Previously, they were server-only, which worked but couldn’t be rendered on clients.
Edit: I noticed that all of my entities have a Prespawn Ghost Baseline Component with a 0 lenght buffer. I still don’t know how to solve the issue but I assume that this is not how it should be.