I am trying to load a subscene at runtime from inside a MonoBehavior without a bootstrap for netcode.
Here’s what I have so far:
using Unity.Entities;
using Unity.Entities.Serialization;
using Unity.NetCode;
using Unity.Scenes;
using UnityEngine;
/// <summary>
/// Boostrap for the scene.
/// </summary>
public class ClientBattleGameSceneBootstrapBehavior : MonoBehaviour {
public EntitySceneReference entityScene;
private World _serverWorld;
private World _clientWorld;
public void Start() {
this._serverWorld = ClientServerBootstrap.CreateServerWorld("server");
this._clientWorld = ClientServerBootstrap.CreateClientWorld("client");
SceneSystem.LoadSceneAsync(this._serverWorld.Unmanaged, this.entityScene);
SceneSystem.LoadSceneAsync(this._clientWorld.Unmanaged, this.entityScene);
}
public void OnDestroy() {
this._serverWorld.Dispose();
this._clientWorld.Dispose();
}
}
When I do this, I can see that an entity for the subscene was created, and that a request entity was also created. However, nothing happens after that; the entity in the subscene are never loaded. What am I missing here?