- Home /
Memory optimization in unity
I'm making a VR application in unity3d which I optimized as much as I can. I've made 2 scenes. After playing same scene again and again the application starts to lag on VR devices. And works smoothly if application is restarted and game is continued from last scene . How can I clear previously loaded scene in Unity3d or overcome the problem I mentioned above ?
Are you loading the scene using Scene$$anonymous$$anager.LoadScene or Scene$$anonymous$$anager.LoadSceneAsync? If you are, make sure you're passing in LoadScene$$anonymous$$ode.Single e.g.:
Scene$$anonymous$$anager.LoadSceneAsync("SceneName", LoadScene$$anonymous$$ode.Single);
Using LoadScene$$anonymous$$ode.Single will unload any other open scenes when used.
Answer by Akadeax · Oct 17, 2018 at 10:17 AM
Normally, when loading a scene, everything in the previous scene is deleted. If the game lags when loading a new scene, you might want to use Resources.UnloadUnusedAssets.
And as DanielAllison said, please make sure you're loading the scene properly.
Your answer
Follow this Question
Related Questions
Handling large vertex counts. 0 Answers
IOS Terminated due to memory issue because of a 2D animation with 60 frames in it 1 Answer
Procedural material memory impact and generation 0 Answers
PathNameManager and BaseObjectManager filling memory in Profiler 2 Answers
ManagedStaticReferences when unload unused resources 0 Answers