How do I hide the loading level behind the loading screen UI for loading all models with textures?

How to delay loading a level? That is, so that the Load screen UI first appears and when a unique FPS is reached or before all models with textures are loaded, the level is loaded and UI disappears.

Hi @didzey , you can use level loading screens (Defining Game and Level Load Screens - Lumberyard User Guide) and can pre-cache required models/textures/shaders in .pak files (lumberyard/ResourceManager.cpp at 414466d63520443fafd8c27c4735fee099914384 · aws/lumberyard · GitHub). You can also force models to load, bypassing the texture streaming so they don’t show up with blurry textures first by using code like this:

auto materialManager = gEnv->p3DEngine->GetMaterialManager();
if (materialManager)
{
    constexpr char* materialName = "valena/valenactor";
    auto material = materialManager->FindMaterial(materialName);
    if (!material)
    {
        // load the material if it isn't already loaded
        material = materialManager->LoadMaterial(materialName);
    }
 
    if (material)
    {
        // force load the textures used by this material without streaming
        material->DisableTextureStreaming();
    }
}

Any other custom logic, I recommend showing a UI screen until your requirements are met (fps stable etc)

2 Likes