Browse Source

Don't destroy sprite objects in Scene Loader #386

master
chrisgregan 9 years ago
parent
commit
00ffca7de5
  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(); 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 // Wait for objects to actually be destroyed at end of run loop
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();

Loading…
Cancel
Save