I have an question that I think is very simple but hard for me to explain. Forgive me I’m fairly new to Godot. Here is an example from my current project:
In my “main” scene I have a node for a character called “Charlotte”. It is a node but also a separate scene.
That made sense to me at the time because I thought they were the same node - just presented in two different places. But I was mistaken, they can be given different names, different properties, and they can even have different scripts attached. So this opens a lot of questions.
which one should have the script for the character? the one in the main scene, or the root one inside the mini scene?
Do they have to be the same node type?
Should they have the same name?
When assigning member variables in the inspector, do I do this for the node in the main scene or for the one in the other scene?
If one has a script, will the other one also have the same functionality even if the script isn’t attached.
Does the node in my “main” scene merely represent a separate scene or is it also a node in itself?
I can think of more questions related to this, but I hope I’m getting the question across enough.
The node in the main scene is an instantiated scene, it has all the children and properties defined in the “Charlotte” scene, though you can override any of their properties and add children. Instantiation is a good way to manage copying nodes.
The Charlotte scene
Yes, I’m pretty confident there is no other way to instantiate a scene.
Depends on your scene and preferred naming convention, most would keep the same name but it is not required and affects nothing.
Set “base” variables in the character’s scene, if you need to override a value you can do so in the main scene. This one-off character may not be a good example, but imagine lamps may have a “default” brightness but you may want one to be a little brighter though a override in the main scene.
No, a inherited scene will by default have the script, but you can override it to clear the script.
It does represent a seperate scene and it contains everything within that scene. If you right click the node you can toggle “Editable Children” to view and override it’s children too.
Thanks. So would it be correct to say that the “Charlotte” scene is a class of sorts (with default member variables) and the Charlotte node in the main scene is an instantiated object of that class?