#Loading level additively not working in build

1 messages · Page 1 of 1 (latest)

buoyant bloom
#

Hey guys - I'm using NGOs and trying to load a shop scene additively in my game. It works just fine in the editor, but it doesn't appear to load the scene at all when I build the game. I can confirm the scene is in the scene list. Any help would be greatly appreciated! Here is the simple code I'm using:

case NodeType.Shop:
    // Load scene additively (Server)
    if (IsServer)
    {
        if (!ShopSceneIsLoadedServer())
            NetworkManager.Singleton.SceneManager.LoadScene(shopSceneName, LoadSceneMode.Additive);
    }

    break;
candid hinge
#

Is this for a dedicated server build or just running as host?

buoyant bloom
#

Running as a host. As in Client Server

candid hinge
#

That should work fine unless ShopSceneIsLoadedServer() is returning true for some reason. You might need to attach the debugger to the build to see what's happening

buoyant bloom
#

Oooo, I didn't know I could do that! Do I do it the same way as with the editor?!

#

It is weird though.. This is that method. Pretty simple.

private bool ShopSceneIsLoadedServer()
{
    if (IsServer)
    {
        // Look at every scene
        for (int i = 0; i < SceneManager.sceneCount; i++)
        {
            // Get scene at index
            Scene scene = SceneManager.GetSceneAt(i);

            // If this is shop scene
            if (scene.name == shopSceneName)
            {
                return true;
            }
        }

        return false;
    }

    return false;
}
candid hinge
candid hinge
buoyant bloom
#

I'll check it out thanks 🙂