# Update Vector Parameter Value to a Material Instance in C++

**URL:** <https://forums.unrealengine.com/t/update-vector-parameter-value-to-a-material-instance-in-c/1892150>\
**Category:** Asset Creation\
**Tags:** unreal-engine, question\
**Created:** [June 6, 2024, 10:22am UTC](https://forums.unrealengine.com/t/update-vector-parameter-value-to-a-material-instance-in-c/1892150 "2024-06-06T10:22:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [June 6, 2024, 10:22am UTC](https://forums.unrealengine.com/t/update-vector-parameter-value-to-a-material-instance-in-c/1892150/1 "2024-06-06T10:22:06Z")

</div>

Hi!

I’m using Unreal 5.3.2 with C++.

I’m using the SM\_Cube\_01 from VREditor content:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/7/f3778050ac41e266a19f0e23336978ec2fe10dee.jpeg)

This cube is using the MI\_Cube\_01 material instance:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/2/3426007f95af27a22afdef9efff82c5a19b080c4.jpeg)

Which have a Vector parameter called _GlowColor_ that I want to change in C++. To do it, I have this code:

```auto
void ATFallingBlockActor::SetStaticMeshColour(FLinearColor CubeColour)
{
	TObjectPtr<UMaterialInstance> Mat_Inst = Cast<UMaterialInstance>(StaticMesh->GetMaterial(0));
	if (Mat_Inst)
	{
		UE_LOG(LogTemp, Warning, TEXT("BuildAddBlock"));
		FMaterialParameterInfo ParameterInfo(FName("GlowColor"));
		Mat_Inst->SetVectorParameterValueInternal(ParameterInfo, CubeColour);
	}
}

```

But it doesn’t work because `SetVectorParameterValueInternal` is a protected method.

I did it with Blueprint, and it is a lot of easier:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/4/a44dbc6207325a932a786c5dbd8a221c8fa80d42.png)

How can I do it C++?

Thank you.
