how to load...

Hello, how to load and unload scenes that changes dynamically.

At the moment i have this :

IEnumerator LoadScene(int mapId, bool RealyLoadMap = false)
        {
            MainComponent.Game.SendNotification(UINotifications.LOADING_NOTIFICATION, "Loading World: 0");

            if (RealyLoadMap)
            {
              
                IAsyncOperation<Scene> op = Addressables.LoadScene(scenes[mapId], LoadSceneMode.Additive);
                while (op != null && !op.IsDone)
                {                
                    yield return new WaitForSeconds(0.1f);
                    MainComponent.Game.SendNotification(UINotifications.LOADING_NOTIFICATION, "Loading World: " + ((int)(op.PercentComplete * 100)).ToString() + "%");
                }
                if(op != null && op.IsDone)
                {
                    bool compleated = false;
                    if (CurrentScene != null && StaticVars.CURRENTMAP != -1)
                    {
                        IAsyncOperation<Scene> opx = Addressables.UnloadScene(CurrentScene);
                        while (opx != null && !opx.IsDone)
                        {
                            yield return new WaitForSeconds(0.1f);
                            MainComponent.Game.SendNotification(UINotifications.LOADING_NOTIFICATION, "Cleaning the house: " + ((int)(opx.PercentComplete * 100)).ToString() + "%");

                        }

                        if (op != null && op.IsDone)
                        {
                            compleated = true;
                        }
                    }
                    else
                    {
                        compleated = true;
                    }
                    if (compleated)
                    {
                        StaticVars.CURRENTMAP = mapId;
                        CurrentScene = op.Result;
                        SceneManager.SetActiveScene(CurrentScene);
                        MainComponent.Game.SendNotification(GameNotifications.MAP_LOAD_COMPLEATE);
                    }
                }
            }

but in the end its not free from Addressable memory or unity memory.

Thanks.

Great work btw.

Also i get this warnings:
Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations

I am not using any job system… and i am using unity 2018.3.1f1

nvm fixed it

                IAsyncOperation<Scene> op = Addressables.LoadScene(scenes[mapId], LoadSceneMode.Single);
                while (op != null && !op.IsDone)
                {                
                    yield return new WaitForSeconds(0.1f);
                    MainComponent.Game.SendNotification(UINotifications.LOADING_NOTIFICATION, "Loading World: " + ((int)(op.PercentComplete * 100)).ToString() + "%");
                }
                if(op != null && op.IsDone)
                {
                    StaticVars.CURRENTMAP = mapId;
                    MainComponent.Game.SendNotification(GameNotifications.MAP_LOAD_COMPLEATE);
                }