UBorder::GetDynamicMaterial
#include "Components/Border.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns a dynamic material instance for the border's background brush, creating one from the brush's current material if it isn't already a UMaterialInstanceDynamic.
Caveats & Gotchas
- • Only works if the brush's underlying resource is a material, set via SetBrushFromMaterial or in the editor — calling this on a texture-based brush returns nullptr.
- • The first call reassigns a newly created MID onto the brush, so cache the returned pointer rather than calling this repeatedly, e.g. every tick.
Signature
UMG_API UMaterialInstanceDynamic* GetDynamicMaterial() Return Type
UMaterialInstanceDynamic* Example
Animate a border material parameter C++
void UMyUserWidget::PulseBorderMaterial(float Value)
{
if (MyBorder)
{
if (UMaterialInstanceDynamic* MID = MyBorder->GetDynamicMaterial())
{
MID->SetScalarParameterValue(TEXT("Intensity"), Value);
}
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?