I’m loading up prefabs stored in the Resources folder, like so:
this.oneTimeMenu = GameObject.Instantiate(Resources.Load("ScriptPrefabs/Menu/oneTimeMenu")) as GameObject;
Then when I’m done with the menu I’m doing this:
Destroy(this.oneTimeMenu);
Now I’m waiting one game loop and then calling this:
Resources.UnloadUnusedAssets();
Now, in a perfect world, when that is done all textures that were part of the oneTimeMenu prefab should be unloaded. But they aren’t. If I do this:
Texture2D[] allTex = FindObjectsOfTypeIncludingAssets(typeof(Texture2D)) as Texture2D[];
foreach (Texture2D thisTex in allTex)
{
Debug.Log("---*** Texture " + thisTex.name);
}
I can see that the textures are still there. Does anybody have any idea what I’m doing wrong?