Forcing textures to load without streaming

Sometimes you may want certain textures to not stream in to avoid “popping” - say for example on your game’s main menu or something. Here’s a code snippet showing how to do that for the valena actor material from StarterGame

        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();
            }
        }
4 Likes