+1 vote

Why can't instantiated scenes become root?

I am trying to build a vehicle, and each part like the body or wheel is a separate scene so I can instantiate as many of them as required to assemble different vehicles with various combinations.

I want the 'body' scene to be the root node of new vehicle scene that I am creating, but that isn't possible.

asked Feb 29 in Engine by RedPilled (34 points)

1 Answer

0 votes

I'm not sure what the problem is here. It is definitely possible to make the body of the car as root of your scene. Any node you want can be the root.

When creating a new scene, you have choice between Node2D, Spatial or Control, but you can also choose anything else with the button below.

And when you already have a scene with nodes inside it, you can right-click on one of them in the scene tree dock, and in the context menu choose "Make Scene Root".

answered Feb 29 by Zylann (27,004 points)

When I right-click on an instantiated scene and click on "Make scene root", I get this alert:
enter image description here

Also, I just noticed this when I hover over the instance node button:enter image description here

What is the difference between instanced scene and inherited scene?

Huh. I didn't know that.
I thought there was actually no difference between an instanced scene and an inherited scene... because when I think about it, an inherited scene just takes its base nodes and properties from another scene, which is what an instance is (except with editable children turned on by default). Maybe the problem comes from the workflow this implies.

What is the difference between instanced scene and inherited scene?

And that's what I just described. I thought there was no difference. This button also implies that.

In the meantime, instead of "making the instance root" later, you should start by creating your scene as an inherited scene in the first place?

Or ask about that feature in the proposals repo, explaining in detail what you expect would happen when doing this. It must describe all possible cases, because it's possible that it wasnt allowed due to a problem implementing it. For example, it is possible to make an inherited scene if the scene tree is empty, but what happens if you do this while there are nodes in the tree already? What if their name conflict with nodes that your scene will now inherit? I guess that has to be solved.

In the meantime, instead of "making the instance root" later, you should start by creating your scene as an inherited scene in the first place?

Yes, that works. But it doesn't "feel right" because I am trying to make a scene which has nodes that are instances of other vehicles parts like body, wheel, turret etc, with body being the parent of all other nodes as each part is attached to it.

Perhaps you need to make instanced scene local first with Make Local.

Perhaps you need to make instanced scene local first with Make Local.

The problem with making the scene local is that it will duplicate all the scene structure in your current scene, then you lose the capability of changing the root scene and get the changes everywhere ...

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.