What It Means & How to Fix It in UE5
🧠 Why You’re Seeing This Error
This error means Unreal Engine tried to compile or register a shader permutation, but your shader class is missing required metadata that tells the engine which permutations are valid.
It usually occurs when:
- You’re using
UE::ShaderPermutationDomain
-style modern shader architecture, but forgot to define the domain - You subclassed from
FGlobalShader
orFMaterialShader
and didn’t declare a valid permutation domain - You updated to UE5+ where explicit permutation domains are mandatory for some shader workflows
💥 Example Error Message
Fatal Error: Missing ShaderPermutationDomain metadata for shader class 'FMyCustomShader'
🛠️ Common Scenarios That Trigger This
❌ No ShaderPermutationDomain
Type Defined in Shader Class
class FMyCustomShader : public FGlobalShader
{
// ❌ Missing using FPermutationDomain = ...;
};
❌ You Added a ShouldCompilePermutation()
Without a Permutation Domain
// Added custom permutation logic
static bool ShouldCompilePermutation(...) { return true; } // ❌ No permutation domain defined
❌ Incorrectly Registered Shader Type Without Permutation Info
IMPLEMENT_SHADER_TYPE(, FMyCustomShader, TEXT("/Shaders/MyShader.usf"), TEXT("MainVS"), SF_Vertex);
// ❌ But FMyCustomShader is missing domain metadata
✅ How to Fix It in UE5 – Step-by-Step
✔️ 1. Define a Permutation Domain Struct
This tells Unreal what compile-time options (macros) to use.
class FMyCustomShader : public FGlobalShader
{
public:
class FMyPermutation : SHADER_PERMUTATION_BOOL("USE_FEATURE_X");
using FPermutationDomain = TShaderPermutationDomain;
// ...
};
You can define multiple flags:
cppCopyEditclass FUseShadow : SHADER_PERMUTATION_BOOL("USE_SHADOW");
class FUseNormal : SHADER_PERMUTATION_BOOL("USE_NORMAL");
using FPermutationDomain = TShaderPermutationDomain<FUseShadow, FUseNormal>;
✔️ 2. Register Permutations in ShouldCompilePermutation()
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return true;
}
If you don’t need any variation, you can use an empty domain:
using FPermutationDomain = TShaderPermutationDomain<>;
✔️ 3. Update ModifyCompilationEnvironment()
If Needed
If you want to define compile-time macros manually:
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
FPermutationDomain PermutationVector(Parameters.PermutationId);
if (PermutationVector.Get())
{
OutEnvironment.SetDefine("USE_FEATURE_X", 1);
}
}
✅ Summary: How to Fix “Missing ShaderPermutationDomain Metadata for Shader Class” in UE5
Cause | Fix Example |
---|---|
Shader class missing domain definition | Define using FPermutationDomain = ...; |
No permutation metadata registered | Use SHADER_PERMUTATION_BOOL , VALUE , or custom enums |
Forgot to define an empty domain | Use TShaderPermutationDomain<> if no macros needed |
Misconfigured IMPLEMENT_SHADER_TYPE | Ensure shader class has all required metadata for permutations |