#How do I store data in global variable script? I already did the autoload and named the global scrip

3 messages · Page 1 of 1 (latest)

split grove
#

Global:

extends Node2D

var number

func _ready():
    number = 2
    
func _on_button_button_down():
    print(number)
    
func changeNumber(newValue):
    number += newValue

Script from another scene:

extends Node2D

@onready var main = $".."

func _on_button_button_down():
    Global.changeNumber(5)
brittle sedge
#

that is how you do it

#

what is the matter?