# Dynamic Material Set Scalar Value not working I am missing something?

**URL:** <https://forums.unrealengine.com/t/dynamic-material-set-scalar-value-not-working-i-am-missing-something/2363183>\
**Category:** C++\
**Tags:** unreal-engine, dynamic, question\
**Created:** [February 27, 2025, 6:44pm UTC](https://forums.unrealengine.com/t/dynamic-material-set-scalar-value-not-working-i-am-missing-something/2363183 "2025-02-27T18:44:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguline](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@miguline](https://forums.unrealengine.com/u/miguline)\
**Post date:** [February 27, 2025, 6:44pm UTC](https://forums.unrealengine.com/t/dynamic-material-set-scalar-value-not-working-i-am-missing-something/2363183/1 "2025-02-27T18:44:17Z")

</div>

So I am using this code for applying set Scalar Value, The value is working right but is not applying

This is on the begin play:

BarrelMaterial = GetMesh()-\>GetMaterials()[0];  
BarrelMaterialInstance = UMaterialInstanceDynamic::Create(BarrelMaterial, this);  
GetMesh()-\>SetMaterial(0, BarrelMaterialInstance);

This is on the Tick function:

CurrentAlphaBarrelOpacity = FInterpFunction(GetWorld()-\>DeltaTimeSeconds, CurrentAlphaBarrelOpacity, 0.0f, SpeedToVanishBarrel);

BarrelMaterialInstance-\>SetScalarParameterValue(“Alpha”, CurrentAlphaBarrelOpacity);

UE\_LOG(LogTemp, Warning, TEXT(“Show Alpha %f”), CurrentAlphaBarrelOpacity);

the LogTemp, Alpha is giving 0 so is Right, and when I pause the game the Dynamic Material is applying right, so I can open the Dynamic material on the engine and change the Scalar parameter Value without problem to do the fade, the name Alpha is spelled right too.
