Loading scenes and unload?

When we load a scene using " SceneManager.LoadScene()" do we have to unload the previous scene? or it does that automatically ? my question is for optimization and the memory, thank you.

Hi,

it is done automatically by the garbage collector. Only those gameobjects will survive the load which are marked with DontDestroyOnLoad. Details: https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html

1 Like

Oh thank you so much.