I have a very simple game in which the player, from the main game scene, can click a button to load an inventory scene.
In this inventory scene, I have only a Scroll View that gets populated at runtime with something like the following:
foreach (var c in coins)
{
coin = Instantiate(coinTemplate);
coin.transform.SetParent(content.transform, false);
// some other stuff on this coin
}
In Editor everything works perfectly, the issue is that on Android and on iOS I have very bad performance degradation every time the user switches between the two scenes. So the first time the inventory gets loaded game performance is normal, it gets slower after 2 or 3 times and unusable after 7 o 8 times.
Could it be a garbage collection problem?
I have tried to follow suggestions from the following link, but it didn’t help: