Using StarOpenSource UI
Here's how you can add SUI elements into your scene.
Editor
To insert a UI element into a scene from the editor, follow these steps:
- Open the
res://SUI/scenesrc
folder in the filesystem panel - Drag the UI element you want (for example
SuiTextButton.tscn
) into your scene - You're done. You can now edit the element's properties.
Code
To insert a UI element into a scene from code, implement this code in your script(s):
add_child(load("res://SUI/scenesrc/REPLACETHIS.tscn").instantiate())
Make sure to replace REPLACETHIS
with the UI element you want, for example SuiTextButton
.
Example
extends Node
# CORE
var core: Core = Core.new()
@onready var logger: CoreLoggerInstance = core.logger.get_instance("src/init.gd")
func _ready() -> void:
# CORE Framework initialization
await get_tree().process_frame
get_tree().root.add_child(core)
await core.complete_init()
logger.info("Adding REPLACETHIS.tscn")
add_child(load("res://SUI/scenesrc/REPLACETHIS.tscn").instantiate())
Make sure to replace REPLACETHIS
with the UI element you want, for example SuiTextButton
.