Hello guys!
I am trying to create a random linear color in c++, but i dont know how, can someone help me?
Here is moreless what i want to do from BP to c++.
Hello guys!
I am trying to create a random linear color in c++, but i dont know how, can someone help me?
Here is moreless what i want to do from BP to c++.
I think the alpha (A) needs to be set to 1.0f.
HTH
Lucky for you, there’s already a nice static function for it:
FLinearColor::MakeRandomColor();
Even the comment has ‘Nice’ in the title:
How do I set it to an actor?
Like this?
Actor->SetMaterial(FLinearColor::MakeRandomColor());
You will need to use one of the set “Type” parameter methods, Here is an example:
pMaterialInst->SetScalarParameterValue( FName( TEXT( "EnergyLevel" ) ), energyInterval );
HTH