render_widget_preview
Render a Widget Blueprint to a PNG on disk without running the game, giving a design-time UMG preview to check styling before PIE.
Instructions
Render a Widget Blueprint to a PNG on disk WITHOUT running the game: builds the widget with the editor's own designer flags, draws it through FWidgetRenderer into a render target and writes the file. This is what turns "does this style look right?" from a PIE session someone has to watch into a static read plus one image to LOOK at. HONEST SCOPE: it is a DESIGN preview, the same thing the UMG Designer shows -- not the live HUD. Anything that only exists while the game runs (text filled in NativeConstruct, property bindings, ViewModel data, anything behind an IsDesignTime() guard) renders at its default/empty value. Use read_pie_widgets or capture_pie_screenshot for the running session. Returns rendered:false with a reason (never a blank image) when the editor has no RHI (-nullrhi/headless), because FWidgetRenderer cannot draw there.
Returns: { widget_bp_path: string, rendered: bool, file_path: string, width: int, height: int, scale: number, drew_at_desired_size: bool, byte_size: int, designer_flags: string, preview_note: string, error?: string }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Optional draw scale applied by the renderer (default 1.0), the equivalent of DPI scaling in the Designer. | |
| width | No | Optional render width in pixels. Omit BOTH width and height to render at the widget's own desired size (a Slate prepass measures it). | |
| height | No | Optional render height in pixels. Omit BOTH width and height to render at the widget's own desired size. | |
| output_path | No | Optional output file. A bare name lands under <ProjectSaved>/MCP/WidgetPreviews/, an absolute path is used verbatim, and .png is appended when missing. Defaults to the asset's name. | |
| blueprint_name | No | Alias of `widget_bp_path` (same value, same meaning). Accepted because sibling tools spell this parameter differently; prefer `widget_bp_path`. | |
| widget_bp_path | No | /Game path of the Widget Blueprint asset to render | |
| opaque_background | No | Optional (default false). Force every pixel's alpha to 255 so the PNG is not transparent where the widget did not paint -- the same trick capture_viewport uses. Leave false to keep real transparency. |