- Home /
Texture memory in Webplayer
Hello, I'm having an issue with Textures in the Webplayer (It works fine in the editor). I load the various stage parts from the resource folder. However, when I switch stages enough times (IE, load a certain number of objects - namely textures), the textures no longer display correctly.
I assume that the issue is that Unity isn't removing the textures from memory when they are no longer in use, but my attempts to fix the issue using UnloadAsset and UnloadUnusedAssets have proven to be ineffective. Does anyone know the correct way to manage textures loaded from the Resource folder?
How are you displaying the newly-loaded textures? If the top image is the one with messed-up images, it looks like there's a black plane covering up part of the image, or else the plane displaying the image has somehow been moved upward.
Yeah, that's what's odd. The only difference between these two images is that in the top one, I loaded a bunch of different scenes beforehand (probably a few 100 $$anonymous$$bs of textures).
The sprites themselves have abandoned their $$anonymous$$aterial/Texture settings and are being rendered as a black plane.
I found this error in the webplayer log: d3d: failed to create 2D texture id=2267 w=1024 h=1024 mips=11 d3dfmt=21 [out of memory]
So, it's definitely an issue with GPU memory. But why isn't it getting fixed by using UnloadUnusedAssets? Note, using the function crashes the program... perhaps because I'm referencing the Textures in a non-$$anonymous$$onoBehavior class?
Apparently the issue with crashing was caused by the sounds in the game, so we can ignore that. But, even if I run UnloadUnusedAssets the textures don't seem to be unloaded?
What I really want is a way to remove the textures from the GPU, but keep them in RA$$anonymous$$. Is that possible?