Hi, I asked in the ‘c++’ section, but think here might be better;
I’m having some trouble,
I have an actor I’d like to change the colour of depending on which state it’s in, I was trying to use the command SetVectorParameterValue;
If I call it in ‘begin play’ it works,
If I call it in ‘on overlap’ it doesn’t work.
In the .h there’s:
UMaterialInstanceDynamic* MatDynamic;
In the .cpp there’s:
.........beginPlay()..........
UStaticMeshComponent* MeshComp = SphereVisual;
if (MeshComp)
{
MatDynamic = MeshComp->CreateAndSetMaterialInstanceDynamic(0);
}
........OnOverlap....................
MatDynamic->SetVectorParameterValue("InputColour", FVector(0.0f, 1.0f, 1.0f));
The code Is called, but the colour doesn’t change. If I call ‘SetVectorParameterValue’ in ‘beginPlay’ it’ll change the mesh to that colour. But I can’t seem to ‘update’ the colour during the game.