UE4.22.3 Debug views crashing cooked (none shipping) builds

I have noticed that when turning on r.ForceDebugViewModes=1 in *ConsoleVariables.ini *a packaged build (Development build in my case, not shipping!) that you will get a crash when turning some of the Debug Views such as wireframe or lit modes (materials = 0).

It seems to be that the Engine can’t find these material assets on load, and as such can’t load them as a SpecialMaterial. Which in turn causes a crash when the renderer tries to access these materials for these debug views.

Now I’ve come to understand that the debug views have been substantially limited in recent versions, likely for good reasons. But when in a none-shipping build it states that forcing them on should work, but it still causes a crash.

Has this been fixed in >4.22.3 versions?

The place it crashes is bound to this in UnrealEngine.ccp, where it tries to load these materials (r.ForceDebugViewModes=1 enables AllowDebugViewmodes()) :


// initialize the special engine/editor materials
    if (AllowDebugViewmodes())
    {
        // Materials that are needed in-game if debug viewmodes are allowed
        LoadSpecialMaterial(TEXT("WireframeMaterialName"), WireframeMaterialName, WireframeMaterial, true);
        LoadSpecialMaterial(TEXT("LevelColorationLitMaterialName"), LevelColorationLitMaterialName, LevelColorationLitMaterial, true);
        LoadSpecialMaterial(TEXT("LevelColorationUnlitMaterialName"), LevelColorationUnlitMaterialName, LevelColorationUnlitMaterial, true);
        LoadSpecialMaterial(TEXT("LightingTexelDensityName"), LightingTexelDensityName, LightingTexelDensityMaterial, false);
        LoadSpecialMaterial(TEXT("ShadedLevelColorationLitMaterialName"), ShadedLevelColorationLitMaterialName, ShadedLevelColorationLitMaterial, true);
        LoadSpecialMaterial(TEXT("ShadedLevelColorationUnlitMaterialName"), ShadedLevelColorationUnlitMaterialName, ShadedLevelColorationUnlitMaterial, true);
        LoadSpecialMaterial(TEXT("VertexColorMaterialName"), VertexColorMaterialName, VertexColorMaterial, false);
        LoadSpecialMaterial(TEXT("VertexColorViewModeMaterialName_ColorOnly"), VertexColorViewModeMaterialName_ColorOnly, VertexColorViewModeMaterial_ColorOnly, false);
        LoadSpecialMaterial(TEXT("VertexColorViewModeMaterialName_AlphaAsColor"), VertexColorViewModeMaterialName_AlphaAsColor, VertexColorViewModeMaterial_AlphaAsColor, false);
        LoadSpecialMaterial(TEXT("VertexColorViewModeMaterialName_RedOnly"), VertexColorViewModeMaterialName_RedOnly, VertexColorViewModeMaterial_RedOnly, false);
        LoadSpecialMaterial(TEXT("VertexColorViewModeMaterialName_GreenOnly"), VertexColorViewModeMaterialName_GreenOnly, VertexColorViewModeMaterial_GreenOnly, false);
        LoadSpecialMaterial(TEXT("VertexColorViewModeMaterialName_BlueOnly"), VertexColorViewModeMaterialName_BlueOnly, VertexColorViewModeMaterial_BlueOnly, false);
    }

It seems it then crashes trying to find the packages for the assets of these materials with an error like:


...Couldn't find file for package /Engine/EditorDebugMaterials/WireframeMaterial requested by async loading code...

I tried adding these packages with *PackagesToBeFullyLoadedAtStartup to BaseEngine.ini *but that didn’t seem to help. Any ideas on how to fix this? I really need to these debug views to work in development builds for my project.

The problem solved itself. Not sure what changed but I no longer have this issue. I believe it had to do with how I made my cooked packages.