I have two scenes, dungeon and battle, when an encounter happens in the dungeon I disable arbitrary things there and load battle scene sync using the LoadSceneAsync API, and after this, I pass the SceneInstance thought context, so later on I can unload the battle scene using this cached SceneInstance, something like
private IEnumerator Encounter()
{
// Fade in
yield return fadeBackground.FadeInRoutine();
// Hide/Disable dungeon things
OnChangeToBattleScene?.Invoke();
// Load battle scene
var sceneChangeHandle = battleScene.LoadSceneAsync(LoadSceneMode.Additive);
yield return sceneChangeHandle;
ctx.battleScene = sceneChangeHandle.Result;
// Trigger event
GameEvents.Battle.RaiseSetupBattle(ctx);
}
BUT now I have a rigid sequence of actions - dungeon → battle → dungeon - which is fine for a release version, but during dev, I want to be able to change between scenes in any arbitrary sequence, but I cant find a way to create a SceneInstance that is required for UnloadSceneAsync. Any help is welcome