I can create material expression vector constant with following code without problem:
UMaterialExpressionVectorParameter* mepAlbedoColorTint = NewObject<UMaterialExpressionVectorParameter>(materialDefinition);
mepAlbedoColorTint->Group = *FString::Printf(TEXT("%s %d"), *FString("Layer"), (i+1));
mepAlbedoColorTint->ParameterName = *FString("Albedo Color Tint");
However TextureObjectParameter constant with similar approach gives me error:
UMaterialExpressionTextureObjectParameter* mepRoughnessTexture = NewObject<UMaterialExpressionTextureObjectParameter>(materialDefinition);
mepRoughnessTexture->Group = *FString::Printf(TEXT("%s %d"), *FString("Layer"), (i+1));
mepRoughnessTexture->ParameterName = *FString("Roughness Texture");
mepRoughnessTexture->Texture = UAssetContainer::texturePacks[i].roughness;
ERROR: Material expression called Compiler->Texture() without implementing UMaterialExpression::GetReferencedTexture properly
This is thrown from HLSLMaterialTranslator.cpp: 4935
- The error seems like I should make my own class of TextureObjectMaterial deriving from UMaterialExpressionTextureObjectParameter and overriding GetReferencedTexture function?
- If so, how can I do this “properly” like the error says?