RealDocs

UKismetMaterialLibrary::SetScalarParameterValue

function Engine Blueprint Since unknown
#include "Kismet/KismetMaterialLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Sets a scalar (float) parameter value on the current world's instance of a Material Parameter Collection.

Caveats & Gotchas

  • Logs a warning and does nothing if ParameterName doesn't match a scalar parameter defined on the collection — typos fail silently at runtime except for the log message.
  • This writes to the per-world MaterialParameterCollectionInstance, so the change is visible to every material in that world referencing the collection, not just one object.
  • Not networked — each client and the server maintain independent collection instances, so this must be called on every machine that needs to see the change.

Signature

static void SetScalarParameterValue(UObject* WorldContextObject, UMaterialParameterCollection* Collection, FName ParameterName, float ParameterValue)

Parameters

Name Type Description Default
WorldContextObject UObject* World context used to resolve the current world's collection instance.
Collection UMaterialParameterCollection* The Material Parameter Collection asset containing the scalar parameter.
ParameterName FName Name of the scalar parameter to set, as defined on the collection.
ParameterValue float New value for the scalar parameter.

Return Type

void

Example

Drive a day/night parameter from gameplay code C++
UKismetMaterialLibrary::SetScalarParameterValue(this, DayNightCollection, TEXT("SunAngle"), CurrentSunAngle);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.