Calling UStaticMeshComponent::GetMaterial() during a Blueprint compile on load can cause the Material shader to fail to compile because GetMaterial will trigger a PostLoad call on that Material and cause it to be loaded in an order the Editor doesn't expect. Material Instances for that material that failed to compile will show the default world material in the viewport and in content browser thumbnails until the Material Instance is opened up or RECOMPILESHADERS CHANGED is run. If the the game is cooked before the materials are fixed they will show as the world grid material in game also.
if (Blueprint->SimpleConstructionScript) { for (USCS_Node* Node : Blueprint->SimpleConstructionScript->GetAllNodes()) { if (auto StaticMeshComponent = Cast<UStaticMeshComponent>(Node->ComponentTemplate)) { for(int i=0; i < StaticMeshComponent->GetNumMaterials(); ++i) { auto Material = StaticMeshComponent->GetMaterial(i); } } } }
Expected
Materials shaders compile correctly and Material Instances don't use the default world material
Actual
Some Material shaders will not compile correctly because UStaticMeshComponent::GetMaterial() will trigger a UMaterial::PostLoad() call and cause the Material to be loaded in an order the Editor does not expect. Material Instances for that material that failed to compile will show the default world material in the viewport and in the content browser thumbnail render until the Material Instance is opened up or RECOMPILESHADERS CHANGED is run.
I am not able to find world outliner how to enable it?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
How can i modify the param name in EQS node
Lighting Turns Black in Play Mode
Delay nodes occasionally don't fire the "Completed" output in a nativized build
How to achieve HLSL Multiple Render Target in Material blueprints?
What method is used to fill polygonal regions when drawing spline mesh at run time?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-226715 in the post.
0 |
Component | UE - Rendering Architecture - Materials |
---|---|
Affects Versions | 5.4, 5.4.4 |
Created | Oct 4, 2024 |
---|---|
Resolved | Oct 7, 2024 |
Updated | Oct 21, 2024 |