Quick answer: Set render_target_update_mode = UPDATE_ALWAYS, refresh the viewport size on parent resize, and re-link the texture to display materials.
A 3D inventory preview uses a SubViewport with rotating object. After window resize, the viewport renders blank. The texture went stale.
Update Mode
$SubViewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS
Default UPDATE_WHEN_VISIBLE may skip frames; ALWAYS forces re-render every frame.
Resize Handling
func _notification(what):
if what == NOTIFICATION_WM_SIZE_CHANGED:
$SubViewport.size = $Display.size
$SubViewport.get_texture() # force refresh handle
On window resize, refresh the SubViewport’s size to match the display surface.
Re-bind Texture to Material
$Display.material.set_shader_parameter("viewport_tex", $SubViewport.get_texture())
After internal recreation, the texture handle may differ. Re-bind to the material.
Verifying
Resize window. Inventory preview continues rendering. Test minimize/restore; viewport returns to rendering correctly.
“SubViewport state can stale on resize. Force update mode and refresh size to keep it alive.”
For perf-sensitive previews (inventory, character select), use UPDATE_ONCE on click and cache the texture — saves rendering each frame.