UKismetMaterialLibrary::GetScalarParameterValue
#include "Kismet/KismetMaterialLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Reads the current value of a scalar (float) parameter from a Material Parameter Collection instance. Logs a warning and returns 0 if ParameterName doesn't exist in the collection.
Caveats & Gotchas
- • Reads from the current world's MPC instance, so a value set earlier this frame via SetScalarParameterValue is reflected immediately.
- • Returns 0.0 without an error dialog if ParameterName is invalid — check the output log rather than assuming the result is meaningful.
- • WorldContextObject must resolve to a valid world; passing null or a CDO fails to find the MPC instance.
Signature
static ENGINE_API float GetScalarParameterValue(UObject* WorldContextObject, UMaterialParameterCollection* Collection, FName ParameterName); 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 read, as defined on the collection. | — |
Return Type
float Example
Read back an MPC scalar parameter C++
const float TimeOfDay = UKismetMaterialLibrary::GetScalarParameterValue(this, DayNightCollection, TEXT("TimeOfDay")); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?