a

New Scene User Interface vs Panel Container

Adrian Cabornay(adriangdquest)

Good day,

Adrian here,

Thank you for answering my last question,

I have a question. Why do we use user interface for our ScoreForm.tscn if we can just use Other node and use the panel container instead? like what we have done with the Scoreboard.tscn?


  • Nathan Lovato replied

    Hi Adrian,

    I'm unsure I understood the question. Are you asking why we use a separate scene for the score form instead of having it as a child of the main scene?

    If that's the question, the answer is that it's a matter of organization. We could have the score form as a child of the main scene, but it can be thought of as a standalone piece of the game. It's a form that could work independently of the scoreboard. It's also a way to keep the main scene less cluttered.

    Was that the question? If not, could you please give me more details about what you meant?

    1 love
  • a
    Adrian Cabornay(adriangdquest) replied

    Hi sir Nathan, 

    Thank you for the reply,

    I mean, I don't understand what is the use of the "control" node which we rename into "ScoreForm".

    Can't we just use another "panelcontainer" node again and add child the hboxcontainer and it's children? To create the "Scoreform".

    Overall, I want to understand why we go to create new scene then we select "User Interface" Which created the "control" node. 

    Does the "control" Node have specific properties that is useful for creating the ScoreForm? 😅

    And what is the advantage of control node over the panelcontainer node? 

    I apologize for the confusing and long question, it's just I want to understand every node I use. 

    Can you recommend me where I can fully read the uses of the nodes ? 


  • Nathan Lovato replied

    Hi Adrian,

    Got it! So, we haven't explained this yet at this point in the course but all nodes inherit from parent node types. A PanelContainer is a Control node. It has all the features of the Control node and some more to make it a PanelContainer.

    So, using either a Control node or a PanelContainer works either way. The difference is that a Control node is more generic, it's invisible and it doesn't force its children to have a specific size. While the PanelContainer is a specific kind of Control node, a container, and containers always force their child control nodes to have a specific size and position (based on the properties of those child nodes).

    In the case of the score form, we need the scoreboard and the form to be present in the scene. We don't want to force the size of the scoreboard and the form to be a specific size. A plain Control node is an invisible box that doesn't impose any constraints on its children, so it's perfect for this use case.

    I hope that helps!

    As for learning fully the uses of nodes... there's a ton to learn! There's so much to say that we made a product about this, Godot node essentials. But it's intermediate-level content, so it's only for after finishing a course like this one. You can also learn a lot for free, the information is just scattered. While it's not the most fun thing to do, reading the Godot documentation front to back is a great way to learn about many features of Godot, including a number of nodes.

    1 love
  • a
    Adrian Cabornay(adriangdquest) replied

    Fully understood sir, Thank you.