The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes


**Godot version:
OS/device including version:
Windows 10
Minimal reproduction project:!Arug_xB8WkZQtFRNDgHJ-GwbbneK?e=PnlxAB**
I have scene MovingAndReparenting.tscn:


I want to render Viewport content to ViewportTexture of first MeshInstace.

Unfortunately I have to move the node of Spatial1 to another place of the scene in space at the start function.

That's why the objects I render to Viewport are not its children at start. (Viewport is not a Spatial type, so they would not move to a new place in space).

After moving Spatial1 node to a new place and reparent child nodes to Viewport there is nothing projected from Viewport.

Script for that scene:

func _ready():

    # translate Spatial1 to new location

    # parent all nodes to Viewport node
    for N in master_node.get_children():
        # leave first node because it is a Viewport
            if N != master_node.get_child(0):
                var node = N
                # translate also child nodes

    # set viewport texturte to mesh node albedo
    mesh_node.get_surface_material(0).albedo_texture = viewport_node.get_texture()
    # update viewport path

But scene tree is correct in remote:


Interesting thing is when i save scene to tscn from code:

var packed_scene =
packed_scene.pack(get_tree().get_current_scene())"res://my_generated_scene.tscn", packed_scene)

there is no children nodes of Viewport in that tscn file but in remote i see that nodes as children of Viewport

In that project i made also scene WithoutMovingAndReparenting.tscn where:

I place Spatial1 node and his child nodes to another place in scene in editor without any reparenting script operations.

Script for that scene:

extends Spatial

onready var viewport_node = get_node("/root/Spatial/Spatial1/Viewport")
onready var mesh_node = get_node("/root/Spatial/MeshInstance")

func _ready():
    # set viewport texturte to mesh node albedo
    mesh_node.get_surface_material(0).albedo_texture = viewport_node.get_texture()

And it that case Viewport works good.

Does anyone have any idea why this is happening?
How to deal with such a problem? Doesn't Viewport update the data correctly?

in Engine by (39 points)

For the record, this was cross-posted to

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.