Jump to content

Guide to the Godot game engine/Docks

From Wikibooks, open books for an open world

A dock is a side panel. Examples are Inspector and Scene.

First, to create a bottom panel, you need to make a UI for it:

  1. Create a scene and choose User Interface, and rename the root Control node to dock.
  2. Save it inside your plugin folder, in the same place as the plugin script, under the name "dock.tscn".
  3. Select your Control, press Layout from the top of the screen, and press Full Rect from the drop down menu that appears.
  4. With the Control still selected, expand Rect in the Inspector and change min_size.x to 60 (or some larger value) to ensure your UI appears with a non zero size.
  5. Create the main UI as a child of the VBoxContainer.

Now, open your plugin's main script, and type the following code:

expands Control

var dock: Control

func _enter_tree():
  # Put any load logic here, including adding new project settings
  dock = preload("dock.tscn").instance()

func _exit_tree():
  # Put exit tree logic here, including any saving
  remove_control_from_bottom_panel(dock)
  dock.queue_free()



Guide to the Godot game engine

Getting started [edit]
Installation
What is a node?
Programming
Resources and importing
Signals and methods
Your first game
Making it work
Debugging
Input
Physics
Saving and loading
Multiplayer
Making it look good
UI skinning
Animation
Advanced help
Servers (singletons)
Platform specific
Optimisation
Encryption
Exporting
Plugins
Miscellaneous
Helpful links
Authors and contributors
Print version


<-- previous back to top next -->