extends HBoxContainer @export var target: Node2D @export var property: String @export var min = 0 @export var max = 100 @export var label = "" @onready var SliderNode = $Slider @onready var ValueNode = $Value @onready var LabelNode = $Label # Called when the node enters the scene tree for the first time. func _ready(): LabelNode.text = label SliderNode.min_value = min SliderNode.max_value = max SliderNode.drag_ended.connect(_drag_ended) SliderNode.drag_started.connect(_drag_started) var value = target.get(property) ValueNode.text = "%.02f" % value SliderNode.set_value_no_signal(value) set_process(false) func update(): target.set(property, SliderNode.value) ValueNode.text = "%.02f" % SliderNode.value func _drag_ended(changed): if changed: update() func _drag_started(): set_process(true) func _process(delta): update()