Download

Set Material Colour Easily (using variable?)

Hello,

So I’m making a game with a very simple art style. No models have any textures - just different colours. The way I’ve been doing this is by making a different material for each colour I use. However, I know in Unity there’s a way to change the colour of each material channel of a model (or blueprint actor) however you wish through use of a colour variable, rather than using a different material every time. Does anyone know how to achieve this? Thanks for any help!

Add this kind of for character.



if (USkeletalMeshComponent* m = this->GetSkeletalMeshComponent())
{
   m->SetVectorParameterValueOnMaterials(FName(TEXT("Color")), FVector(1.f, 0.f, 1.f););
}


Then make material that has VectorParameter named “Color”.