Tricks for runtime

Editor vs game

var scene_camera = null
if Engine.is_editor_hint():
	scene_camera = EditorInterface.get_editor_viewport_3d().get_camera_3d()
else:
	scene_camera = $Camera3D

Get window (viewport) size

var window_size = get_tree().get_root().size

Close the app

get_tree().quit()

Hide group of elements

get_tree().call_group_flags(SceneTree.GROUP_CALL_REALTIME, "StartupHide", "hide")

Change label color (break current style)

label.add_color_override("font_color",
    Color("ffffff") if scale_value == (i+1) else Color("bdbdbd"))

Update label size

Detect mouse click on Control

Load scene at runtime

But in case that scene is optional, then use a ResourceLoader

Reassign resources in code

Load textures as resources. Drag and drop resources into the editor for the path

Get local scene root

Last updated