Browse Source

Yield until unused assets have been unloaded

master
chrisgregan 11 years ago
parent
commit
b3204ac1bd
  1. 5
      Assets/Fungus/Scripts/SceneLoader.cs

5
Assets/Fungus/Scripts/SceneLoader.cs

@ -56,10 +56,11 @@ namespace Fungus
Destroy(room.gameObject);
}
// Wait for objects to actually be destroyed at end of run loop
yield return new WaitForEndOfFrame();
// Most big assets should no longer be referenced, so unload them.
Resources.UnloadUnusedAssets();
// All Room assets should no longer be referenced now, so unload them.
yield return Resources.UnloadUnusedAssets();
// Wait until scene has finished downloading (WebPlayer only)
while (!Application.CanStreamedLevelBeLoaded(sceneToLoad))

Loading…
Cancel
Save