Well I fix the issue with a different approach …
in .h file
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
FLinearColor CurrentBombColor; /// <--------- here
UMaterialInstanceDynamic* BombInstance;
UParticleSystem* ExposionParticles;
bool bBombIsTriggred;
in .cpp file
if (bBombIsTriggred && BombInstance) {
CurrentBombColor = FLinearColor::Black; // <--- here
if (BombInstance) BombInstance->GetVectorParameterValue(FName("BombColor"), CurrentBombColor);
if (BombInstance) BombInstance->SetVectorParameterValue(FName("BombColor"), FMath::CInterpTo(CurrentBombColor, FLinearColor::Red, DeltaTime, 3.f ));
}
Please if you have any better idea, leave some messages.
Your second code snippet does a Get and then a Set, which I assume is what you wanted? The set works as it is not returning the value by reference and so does not need a seperate variable for the function call.