Hi All,
I’m in need of some help.
I have a project which works perfectly fine in the editor. Everything runs, no compile errors. I have one subscene that affects the rest of the project and needs to load in. In the editor it loads in fine with no issue. One I’ve built the project, it doesn’t seem to load at all - regardless of if I’ve set it to auto-load into the main scene.
So I’ve tried to get the scene to auto-load using the checkbox within the subscene component. The scene is closed when I build the project. This didn’t work.
To try and get the scene to load, within a monobehaviour I added the following script:
hsh = SceneSystem.GetSceneGUID(ref _world.Unmanaged.GetExistingSystemState<SceneSystem>(), "Assets/Scenes/SubScene/ESC_SunPath.unity");
if (hsh != null) {
Entity sceneEntity = SceneSystem.GetSceneEntity(_world.Unmanaged, new Unity.Entities.Hash128(hsh.ToString()));
if (SceneSystem.IsSceneLoaded(_world.Unmanaged, sceneEntity))
{
Debug.Log("SceneLoaded");
EffectsManagerVars.escScene1Loaded.Data = true;
//Debug.Log("EffectsManagerVars.escScene1Loaded.Data: " + (EffectsManagerVars.escScene1Loaded.Data));
}
else
{
if (timepassed > 10)
{
Debug.Log("Try Loading");
EffectsManagerVars.escScene1Loaded.Data = false;
var loadParameters = new SceneSystem.LoadParameters { Flags = SceneLoadFlags.LoadAdditive };
SceneSystem.LoadSceneAsync(_world.Unmanaged, sceneEntity, loadParameters);
timepassed = 0;
}
timepassed += Time.deltaTime;
Debug.Log("Click");
}
}
else
{
Debug.Log("Scene Could Not Be Found");
}
This script constantly returns ‘Click’ and ‘Try Loading’ - it never returns ‘Scene Loaded’ and the scene never loads in. Any suggestions of what to look for or what I may be doing wrong?