Forum rules - please read before posting.

Addressable problem with Action Scene - Add or Remove: scene couldn't be loaded...

hey,

probably there is a problem with Action (Scene - Add o Remove) when we are using addressables, should be return... in handle.IsValid () because now we are trying to load scene by addressable and after that using buildsettings index/name, and as a result we will get "...couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded".

Method: public AsyncOperation OpenAsync (LoadSceneMode loadSceneMode = LoadSceneMode.Single)

Comments

  • Welcome to the community, @lukek.

    Thanks for the report - though I'm afraid I'll need a few more details to diagnose the issue. Could you share your AC/Unity versions, as well as error message in full (stacktrace included), along with screenshots of your Action, your Addressable scene file and your Settings Manager?

    now we are trying to load scene by addressable and after that using buildsettings index/name

    Is this to say that you are mix-and-matching built scenes with addressable scenes? I'm not 100% clear on your meaning here - if you can rephrase or illustrate with screenshots, it'll help me understand your situation.

  • Hi,

    this is the action "Scene - Add or Remove" in the newest AC version, I would include the code here but I don't know if I can. Inside condition if(handle.IsValid ()) should be return probably because after that this Action "Scene - Add or Remove" is trying to use standard way to load the scene, and shouldn't do this in my opinion because addressable way was used first with success (result true in condition if(handle.isValid()) - please take a look into your action in AC "Scene - Add or Remove".

    case:
    1. Loading first scene from addressable by action "Scene- Switch" (for example gameplay scene)
    2. Adding (additive) scene by "Action - Add or Remove" from addressable (gameplayinit scene with custom managers etc.)

    Luke

  • Thank you for the details, @lukek. I believe I have recreated the issue.

    To fix, make the following two changes to the codebase.

    1) In the SceneInfo script, look for the following around line 149:

    openSceneHandles.Add (filename, handle);
    

    Just underneath, add:

    return null;
    

    2) In the SceneChanger script, look for the following around line 1198:

    subScenes.Clear ();
    

    Just above, add:

    foreach (var subScene in subScenes)
    {
        if (string.IsNullOrEmpty (subScene.SceneName)) continue;
        SceneInfo subSceneInfo = GetSceneInfo (subScene.SceneName);
        if (subSceneInfo != null) subSceneInfo.Close ();
    }
    

    Do these modifications fix the issue on your end?

  • Hi Chris,

    Thanks a lot for the fix - everything is working correctly now :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.