I am trying to change a mesh object color for every few seconds in C++

please help me with the code and i am really unable to create anything

You’ll need to create a material and assign it in your mesh. The material should have a [parameter][1] to change the color value.

From C++, you’ll grab the assigned material on your mesh, create a MaterialDynamicInstance (so you can modify its values dynamically) and change the color using SetParameterValue

AStaticMeshActor* SM = ...;
UMaterialInterface* BaseMaterial = SM->GetStaticMeshComponent()->GetMaterial(0);
UMaterialInstanceDynamic* DynamicMaterial = UMaterialInstanceDynamic::Create(BaseMaterial, SM, "MyMaterial");
DynamicMaterial->SetVectorParameterValue("MyColor", FLinearColor::Red);