[SOLVED] Is it normal for textures to not unload from VRAM on scene switch?

I noticed that when I load a new scene, the textures on 2D screen do not get unloaded from VRAM memory.

Below is the image where I switch scenes and not manually destroy the textures.
NotManuallyDestroyingTexture

Below is the image where I switch scenes and manually destroy the textures before the switch happens.
ManuallyDestroyingTextures


Wondering if this is normal or not. Project is here:
VRamExample

Hi @JustVlaxx,

Yes, that’s perfectly normal. Assets are included in the project and can be referenced by any scene. Scene include an entity hierarchy and scene settings, they don’t reference assets at all.

When unloading a scene you will have to find and unload all scene assets on your own:

asset.unload();

Note that as soon as you do that, if you load a scene that requires that asset, it won’t be loaded automatically. You are now responsible of loading that asset manually:

this.app.assets.load(asset);
1 Like

Ok, IPhone kept crashing because it was using 350mb of VRAM and just recently understood what was happening.

Will keep track of things and unload only the unnecessary textures, thanks for answer! :slight_smile:

1 Like

Yes, iOS is pretty strict when it comes to memory usage!

1 Like

Yeah, and textures are pretty large and mostly contained in one scene so unloading 95% of them on switch is keeping it under 30mb.

1 Like

Your best friend to solve that, apart from loading and unloading assets, is texture compression if you aren’t doing that already:

https://developer.playcanvas.com/en/user-manual/assets/textures/texture-compression/

We are but it’s like comic pages and they need to be semi-high resolution (yes, they are compressed, clamped and removed mipmaps). :slight_smile:

1 Like