What happen to a texture of a dynamic game object that is invisible in the scene at start?

Hi everyone,

what happen to a texture of a dynamic game object that is invisible in the scene at game start?

My game require about 100MB for textures overall. That’s not much. A lot of game objects existing in the scene at an invisible position first.

When the game starts, and I move about 50 small objects into the visible camera frustum,
then I got a visual shutter spike for all objects are moved for the first time. It seems the textures are loaded for the first time. The amount of 50 mesh memory is extremely low at about 1MB. If they do not have a texture attached then moving the first time is smooth.

So what can I do to make all game object textures (100MB) loaded already into the GPU/RAM before the game starts, to prevent any spiky shutter behavior for the first time they became visible? I’m on U5.5.1.

Thank you.

Textures are loaded On level load , so that is not the problem. My guess is that with the new object so far unused shaders / shader variants are are needed and they need some time to get prepared for use. (that you can test with the Profiler)

Nowadays you should use a ShaderVariantCollection to warm up all required shader variants for your scene.

1 Like

Thank you. I have a look at…

Textures might be loaded on load level, but that usually doesn’t mean they are also in GPU memory. That usually only happens when they become visible. The same thing applies to the mesh data.

I would recommend adding a small loading screen and rendering one of the small objects each frame behind it. That will preload everything nicely onto the GPU and displays a smooth loading screen.

Yes… that the logical issue to me also. The loading screen cannot be a mesh anyway, perhaps an GUI element.

But how can I be assured that all textures and meshes loaded finally into the GPU?
I didn’t find anything in the profiler. And the profiler not an efficient way to solve. In case of continue developing I do not want to look into the profiler every time and add each texture amount step by step to be assured it works. :slight_smile:
Any ideas?