Hello,
Has anyone heard of this happening? When I call 'UnloadUnusedAssets' my app gets odd affect of textures disappearing, or being replaced completely.
The app is a Cartoon Comic book, each page is a prefab that is dynamically loaded via Resource.LoadAsync, and then unloaded when the Page isn't being viewed anymore.
The idea for this method is to reduce memory load as each page contains high quality textures which will crash the app if all loaded in at startup. (for iOS).
This is how I load a page in:
var request : ResourceRequest = Resources.LoadAsync( GetPrefabName(lindex) );
while(request.isDone == false)
yield;
loadedPrefab = Instantiate(request.asset) as GameObject;
So, the problem is, when I try and unload a page like so:
Destroy(scene);
yield WaitForEndOfFrame();
Resources.UnloadUnusedAssets();
System.GC.Collect();
It works fine, the system memory is decreased. But a couple of textures throughout the app are now missing, or have been completely replaced by a random texture. Whats odd though, is that these 'missing' textures are within other dynamically loaded pages (prefabs), meaning the app has to load in everything onto memory anyway, yet the texture may still be incorrect.
Can anyone explain this please? Thanks.
↧