UImage
#include "Components/Image.h" Description
Displays a Slate brush, texture, or material in the UI. Use SetBrushFromTexture(), SetBrushFromMaterial(), or SetBrush() to change the displayed image at runtime.
Signature
class UImage : public UWidget Caveats & Gotchas
- • Direct property access for Brush and ColorAndOpacity was deprecated in UE 5.2. Use the setter functions.
- • Setting a dynamic material instance on UImage allows per-pixel shader effects on UI — use SetBrushFromMaterial() and then SetColorAndOpacity for tinting.
- • Textures displayed by UImage must have 'UserInterface2D' texture group set for correct mip handling and compression.
Example
Change image texture at runtime C++
UTexture2D* NewTexture = LoadObject<UTexture2D>(nullptr, TEXT("/Game/UI/Icons/T_Sword"));
if (NewTexture)
{
WeaponIcon->SetBrushFromTexture(NewTexture);
} See Also
Tags
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?