godot-4
So I’m creating an app that can help me manage what I have to do for each day and I need to call a group that the main scene is attached to as shown in this code. The app is a task list of sorts.
extends Control
@onready var line_edit = $LineEdit
Called when the node enters the scene tree for the first time.
func _ready():
pass
func _on_button_pressed():
print(line_edit.text)
get_tree().call_group(“Information”, “add_information”, line_edit.text)
func _on_button_2_pressed():
get_tree().change_scene_to_file(“res://Scenes/main.tscn”)
The group is called “Information” and I’m sending it a variable that holds a name for a new task so that using it, it can create a new task that pulls up a scene like so.
extends Control
@onready var option_button = $OptionButton
Called when the node enters the scene tree for the first time.
func _ready():
add_to_group(“Information”)
pass # Replace with function body.
func _on_button_pressed():
get_tree().change_scene_to_file(“res://Scenes/TO_DO_List.tscn”)
func add_information(msg : String):
** print(“heya”)**
** option_button.add_item(msg)**
func _on_option_button_item_selected(index):
pass
#if index == 0:
#get_tree().change_scene_to_file(“res://Scenes/Quest_area_1.tscn”)
However the add_information is never called even after I pass the name of the task to it. It doesn’t create a new task with the user inputted variable. The starred areas are with what I need help with.