Hello,
I have a actor class here: http://pastebin.com/59S4dcFP and a header file here: http://pastebin.com/7CA8Aw9F. Basically what I do in this appliaction is that I load a .obj model using procedural mesh. And I want to apply a color on it. Right now just hardcode one color. Later I would like to color mesh depending on the output from assimp. Code I use to set color in my actor is this:
_mesh->GetMaterial(0);
_dynMat = UMaterialInstanceDynamic::Create(_baseMat, this);
_dynMat->SetVectorParameterValue(FName(TEXT("Color")), FLinearColor(1.0, 1.0, 0.0, 1.0));
_mesh->SetMaterial(0, _baseMat);
But that just does not work. What am I doing wrong? Only thing which happens is that I load model without any color or material. And if I set creation of material instance to “this”, then the app crashes. Any lead please?