UKismetRenderingLibrary::ImportBufferAsTexture2D
#include "Kismet/KismetRenderingLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Decodes an in-memory image buffer and creates a new transient Texture2D from it, without touching disk.
Caveats & Gotchas
- • Returns nullptr if Buffer isn't a recognized encoded image format — it does not accept raw pixel data, only encoded file bytes.
- • Useful for textures downloaded over HTTP, but the resulting texture is transient and not cached — call this once and hold onto the result rather than re-decoding on every use.
- • Decoding happens on the calling thread and can stall the game thread for large images; consider decoding on a background thread for big downloads.
Signature
static UTexture2D* ImportBufferAsTexture2D(UObject* WorldContextObject, const TArray<uint8>& Buffer) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | UObject* | World context used to resolve the current world. | — |
| Buffer | const TArray<uint8>& | Encoded image bytes (e.g. downloaded PNG/JPEG data). | — |
Return Type
UTexture2D* Example
Import a downloaded image buffer C++
TArray<uint8> DownloadedBytes = Response->GetContent();
UTexture2D* Texture = UKismetRenderingLibrary::ImportBufferAsTexture2D(this, DownloadedBytes); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?