- Edited
I have a problem, when I change scene all my groups reset and i was looking for a way to in the ready function re add my groups via script
I have a problem, when I change scene all my groups reset and i was looking for a way to in the ready function re add my groups via script
Looking through the online documentation (this page specifically), I found this code snippet:
func _ready():
add_to_group("enemies")
I can't format it to show exactly how it was on the webpage since I don't understand Markdown fully yet, but it seems the built-in function add_to_group
allows you to add any Node to a group. The online documentation also has information on finding nodes in a specific group, as well as calling the same function in all nodes that are part of the script.