Why too much GC after loading scenes for multi-times?
Hi, I'm making a game that I can tap/click to creat units.
Currently I have 2 scenes, one is startScene which has nothing but mainly just a start button, another is the fight scene, in which I can tap to creat units from my object pool.
in the fight scene, each time when I tap, I get a unit from pool, set activate, and set it's position to my tap point, and set it's value like unit camp, unit level, unit spell.
when the fight in the fight scene is over, a win or lose window will pop out, with a button to return to start scene, or if lose a button to retry this fight. all buttons are using SceneManager.LoadScene.
When I switch from scene to scene for like 5 times, it get's very very slow to Tap and creat my unit. Profile window shows that GC is getting too high, that's the cause of the slowness.
so I add a System.GC.Collect() in the loadScene Method, and expect it to do the GC manually.
But still there is too much GC after scene loads.
Help!
Your answer
Follow this Question
Related Questions
Garbage Collection in my Script 1 Answer
garbage collection in between scene changes? 2 Answers
gc allocated/ gc collect 2 Answers
NetworkAnimator leaks memory 0 Answers
What is Image.Start() ?? and How can i reduce this function's GC.Collect 0 Answers