Topic: Stage Loading Method "Scene File" - Error

Hello.

I have a problem with the scene-file loading-method. If I choose the TrainingRoom-scene (path set, added to build), im getting this error at runtime after the scene has loaded (scene shows up correctly in the Hierarchy-window/scene-view):

ArgumentException: SceneManager.SetActiveScene failed; invalid scene
UnityEngine.SceneManagement.SceneManager.SetActiveScene (Scene scene)
UFE.SetActiveStageScene () (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:3004)
FluxCapacitor.ExecuteLocalDelayedActions () (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:876)
FluxCapacitor.ApplyInputs (Int64 currentFrame, Int64 lastSynchronizedFrame) (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:587)
FluxCapacitor.DoFixedUpdate () (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:318)
UFE.FixedUpdate () (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:2282)

I'm working with Unity 2018.3.0f2 and UFE 2.1.1.

Re: Stage Loading Method "Scene File" - Error

Go to File -> Build Settings and under 'Scenes in Build', toggle the TrainingRoom scene.
Under Stages, when selecting 'Scene File' you only need to type the name of the scene (TrainingRoom)

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

3 (edited by shubi 2019-02-10 18:42:07)

Re: Stage Loading Method "Scene File" - Error

Hello.

Thank you for your fast reply. Scene-loading works great now.

But after a fight in story-mode this error shows up:

ArgumentException: Scene to unload is invalid
UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync (System.String sceneName) (at C:/buildslave/unity/build/Runtime/Export/SceneManager/SceneManager.cs:207)
UFE.EndGame () (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:1819)
UFE.HideScreen (.UFEScreen screen) (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:709)
UFE._StartStoryModeConversationBeforeBattleScreen (.UFEScreen conversationScreen, Single fadeTime) (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:2811)
UFE._StartStoryModeBattle (Single fadeTime) (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:2764)
UFE+<StartStoryModeBattle>c__AnonStoreyE.<>m__0 () (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:1112)
FluxCapacitor.ExecuteLocalDelayedActions () (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:876)
FluxCapacitor.ApplyInputs (Int64 currentFrame, Int64 lastSynchronizedFrame) (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:587)
FluxCapacitor.DoFixedUpdate () (at Assets/UFE/Engine/Scripts/Network/Netcode/FluxCapacitor.cs:318)
UFE.FixedUpdate () (at Assets/UFE/Engine/Scripts/Manager/UFE.cs:2282)

the error-message refers to this code in UFE.cs:



if (UFE.config.selectedStage.stageLoadingMethod == StorageMode.SceneFile) {
                SceneManager.UnloadSceneAsync(UFE.config.selectedStage.stagePath);
                SceneManager.SetActiveScene(mainScene);
            }

I added a print-command to find out, whats stored in "UFE.config.selectedStage.stagePath" at this point of time:

if (UFE.config.selectedStage.stageLoadingMethod == StorageMode.SceneFile) {
                print(UFE.config.selectedStage.stagePath);
                SceneManager.UnloadSceneAsync(UFE.config.selectedStage.stagePath);
                SceneManager.SetActiveScene(mainScene);
            }

The result was the name of the next stage, not the stage which should be unloaded.

In VS-Mode scene-loading and scene-unloading works as intended.

Re: Stage Loading Method "Scene File" - Error

Thanks shubi. I'll look into it and fix it soon.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: Stage Loading Method "Scene File" - Error

Is there a quick way, how I can fix scene-loading in story mode by myself (Source-version, UFE 2.1.1)?
I don't want to update UFE to 2.2 at this point of time, because we want to publish our demo soon. Updating would be a lot of work with the customized scripts.

Thank you smile

shubi's Website

Share

Thumbs up +1 Thumbs down

Re: Stage Loading Method "Scene File" - Error

Sure thing
Under UFE.cs, around line 2792 you will see these 2 lines:

UFE.SetStage(UFE.config.stages[UFE.storyMode.currentBattleInformation.possibleStagesIndexes[UFE.lastStageIndex]]);
UFE._StartStoryModeConversationBeforeBattleScreen(UFE.storyMode.currentBattleInformation.conversationBeforeBattle, fadeTime);

All you have to do is switch the order of these lines:

UFE._StartStoryModeConversationBeforeBattleScreen(UFE.storyMode.currentBattleInformation.conversationBeforeBattle, fadeTime);
UFE.SetStage(UFE.config.stages[UFE.storyMode.currentBattleInformation.possibleStagesIndexes[UFE.lastStageIndex]]);
Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

7 (edited by Steviebops 2020-02-05 13:56:12)

Re: Stage Loading Method "Scene File" - Error

Im getting this error, but I already have the lines in that order, could there be another factor?

[Edit] It seems to be I had a scene that didn't follow the naming convention of my other scenes, so it was an error on my end.

Share

Thumbs up +1 Thumbs down

Re: Stage Loading Method "Scene File" - Error

I'm getting this same error while playing arcade, everything seems to be fine, but still i get the error, checked all the scene files and there's nothing out of the ordinary

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Stage Loading Method "Scene File" - Error

ArgumentException: Scene to unload is invalid
UnityEngine.SceneManagement.SceneManagerAPI.UnloadSceneAsyncByNameOrIndex (System.String sceneName, System.Int32 sceneBuildIndex, System.Boolean immediately, UnityEngine.SceneManagement.UnloadSceneOptions options, System.Boolean& outSuccess) (at <4a31731933e0419ca5a995305014ad37>:0)
UnityEngine.SceneManagement.SceneManager.UnloadSceneNameIndexInternal (System.String sceneName, System.Int32 sceneBuildIndex, System.Boolean immediately, UnityEngine.SceneManagement.UnloadSceneOptions options, System.Boolean& outSuccess) (at <4a31731933e0419ca5a995305014ad37>:0)
UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync (System.String sceneName) (at <4a31731933e0419ca5a995305014ad37>:0)
UFE.EndGame (System.Boolean killEngine) (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:2116)
UFE.HideScreen (UFE3D.UFEScreen screen) (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:713)
UFE._StartStoryModeConversationBeforeBattleScreen (UFE3D.UFEScreen conversationScreen, System.Single fadeTime) (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:3227)
UFE._StartStoryModeBattle (System.Single fadeTime) (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:3177)
UFE+<>c__DisplayClass367_0.<StartStoryModeBattle>b__0 () (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:1188)
FluxCapacitor.ExecuteLocalDelayedActions () (at Assets/UFE/Engine/Scripts/Core/Network/Netcode/FluxCapacitor.cs:909)
FluxCapacitor.ApplyInputs (System.Int64 currentFrame) (at Assets/UFE/Engine/Scripts/Core/Network/Netcode/FluxCapacitor.cs:587)
FluxCapacitor.DoFixedUpdate () (at Assets/UFE/Engine/Scripts/Core/Network/Netcode/FluxCapacitor.cs:297)
UFE.FixedUpdate () (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:2596)

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.