mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 06:50:07 +01:00
Fix leaked object - Label (#648)
This fixes a warning of leaked instances.
This commit is contained in:
@@ -9,7 +9,8 @@ onready var label = $VBoxContainer/Label
|
|||||||
onready var button = $VBoxContainer/Button
|
onready var button = $VBoxContainer/Button
|
||||||
onready var button2 = $VBoxContainer/Button2
|
onready var button2 = $VBoxContainer/Button2
|
||||||
onready var reset_all_button = $VBoxContainer/ResetAllButton
|
onready var reset_all_button = $VBoxContainer/ResetAllButton
|
||||||
|
# Save the label color so it can be reset.
|
||||||
|
onready var default_label_color = label.get_color("font_color")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Focus the first button automatically for keyboard/controller-friendly navigation.
|
# Focus the first button automatically for keyboard/controller-friendly navigation.
|
||||||
@@ -63,7 +64,4 @@ func _on_reset_all_button_pressed():
|
|||||||
button2.add_stylebox_override("hover", null)
|
button2.add_stylebox_override("hover", null)
|
||||||
button2.add_stylebox_override("pressed", null)
|
button2.add_stylebox_override("pressed", null)
|
||||||
|
|
||||||
# If you don't have any references to the previous color value,
|
|
||||||
# you can instance a node at runtime to get this value.
|
|
||||||
var default_label_color = Label.new().get_color("font_color")
|
|
||||||
label.add_color_override("font_color", default_label_color)
|
label.add_color_override("font_color", default_label_color)
|
||||||
|
|||||||
Reference in New Issue
Block a user