Static Mesh Dosnt accept dynamic Material

Hello All,

Im trying to apply a dynamic material instance to a static cone mesh. i can apply my non dynamic material normally, but when i try to create a dynamic version and apply that, it simply wont appear on the mesh in the PIE mode.

//.h

//pointer to dynamic material intance

UPROPERTY()
UMaterialInstanceDynamic * ConeMaterialInstance;

**// in the character constructor .cpp

//Get Blueprint Material from project

static ConstructorHelpers::FObjectFinder<UMaterial> ConeMaterial(TEXT("Material'/Game/Material/ConeMat.ConeMat'"));

//Create dynamic Material and store it

ConeMaterialInstance = UMaterialInstanceDynamic::Create(ConeMaterial.Object, this);

//set material to cone mesh

ConeMesh->SetMaterial(0, ConeMaterialInstance);

//ChangeMaterial Color to test

ConeMaterialInstance->SetVectorParameterValue(FName(TEXT("Color")), FLinearColor(2.0f, 0.0f, 0.0f, 1.0f));

For some reason the dynamic material doe not appear and instead shows the default grey check material.

I looked at this post for answers and implement what they said from it, but i still cant get it to work.

Any ideas would be great :slight_smile: i think im missing something really basic.

Try to change mobillity of static mesh component to movable.

mmm, that didnt seem to work either. Its weird the setmaterial() function works when i apply the non dynamic material to it, but when i apply the dynamic material it doesnt work.

The pointer i get back from the Create() funciton is valid and not null, so i assume that means the function has created a dynamic material instance, it just does not want to assign it to the mesh…

Hey -

I am investigating your report about the dynamic instances and would like to ask a couple of questions. Are you still experiencing this issue when using the 4.6 version of the engine? Are you trying to set up the dynamic material in the constructor or elsewhere in the class?

Cheers

Hey ,

Thanks for following this up, i appreciate it. This was for a project i was doing many months ago, I no longer have the files. I found a workaround for it at the time. I know that’s not much help, sorry.

Tom.

Hey -

Since this is no longer a problem for you I will be marking this post as resolved for tracking purposes. If you do come across this issue in the future remember to check the latest version to see if it has already been addressed. If it is still a problem you can reopen this post with any details regarding the error or steps to reproduce it.

Cheers