Browse Source

Merge pull request #398 from FungusGames/remove-sprite-optimization

Don't destroy sprite objects in Scene Loader #386
master
Chris Gregan 9 years ago
parent
commit
1491919c76
  1. 11
      Assets/Fungus/Flowchart/Scripts/SceneLoader.cs

11
Assets/Fungus/Flowchart/Scripts/SceneLoader.cs

@ -50,17 +50,6 @@ namespace Fungus
yield return new WaitForEndOfFrame();
}
// Sprites tend to take up most of the memory in a Fungus game, so destroy all sprite objects
// first to free up memory for loading in the next scene.
SpriteRenderer[] renderers = GameObject.FindObjectsOfType<SpriteRenderer>();
foreach (SpriteRenderer renderer in renderers)
{
if (renderer != null)
{
DestroyImmediate(renderer.gameObject);
}
}
// Wait for objects to actually be destroyed at end of run loop
yield return new WaitForEndOfFrame();

Loading…
Cancel
Save