diff --git a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp index df752c69..881de499 100644 --- a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp +++ b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp @@ -435,6 +435,15 @@ namespace Assets asset->heroOnlyLights = reader.readArray(asset->heroOnlyLightCount); } + // We need to temporarily allocate a runtime buffer + // It's not accessed during the building process, + // but as we're interacting with the runtime, we have to + // allocate a valid buffer for the time we're using it. + if (asset->dpvs.surfaceMaterials) + { + asset->dpvs.surfaceMaterials = builder->getAllocator()->allocateArray(asset->surfaceCount); + } + Game::SortWorldSurfaces(asset); } }