0 votes

Download the zip at the bottom to checkout the reproduceable example project. This project is a short setup I created specifically to demonstrate essentially what I am trying to do. I will assume you can open the project and hence reference nodes/stuff from it in the below explanation.

I am creating scene instances and adding them into my scene tree through code, those scenes themselves will add other scenes to the scene tree also through code. As in the project, I have a main scene, which on ready adds a instance of the child scene, which has a child spatial node with a script that creates an instance of the grandchild scene and adds that as a child. This grandchild has a event handler such that when the mouse key is pressed it adds a cube mesh instance.

If I first press the mouse key, the cube appears. Now if I try to save the root scene with all the child nodes having set their owner to the root node, the resulting packed scene does not have the cube mesh. If I run the saved scene I simply see empty space. I would like the cube to actually get saved as well as it is part of the scene tree and I am setting the owner to the node that is being packed and saved.

Any help is greatly appreciated.
Example zip

Godot version 3.3.2
in Engine by (12 points)

The example project has compiled scripts, so it's not possible to read the code you're using.

Have you followed the mini-tutorial on PackedScene on how to save a node?

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 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 webmaster@godotengine.org with your username.