/Engine/Source/Runtime/Engine/Classes/Materials/MaterialInstanceDynamic.h
Use this function to set an initial value and fetch the index for use in SetScalarParameterByIndex. This function should only be called once for a particular name, and then use SetScalarParameterByIndex for subsequent calls. However, beware using this except in cases where optimization is critical, which is generally only if you're using an unusually high number of parameters in a material and setting a large number of parameters in the same frame. Also, if the material is changed in any way that can change the parameter list, the index can be invalidated.
bool InitializeScalarParameterAndGetIndex ( const [FName](API\Runtime\Core\UObject\FName) & ParameterName, float Value, int32 & OutParameterIndex )