0 votes

sorry for my broken english. and thank for help

when i click increase button in main map, number didt change, but when i change map, num_count change to right value. and same thing happend in second map, value did't change until i go to other map. why this happend and how to fix it?

so i make 1 singelton and 3 scene
1 singelton name (global_object)with script:

  var num = 1

~scene~
1
i make node(bob)> label(num_count) with code:

func _ready():
    $num_count.set_text(str(int(global_object.num)))

2
main map
- button for next_map with code:

func _on_next_map_pressed():
    get_tree().change_scene("res://new_world.tscn")

-button to increase number with code:

func _on_increase_pressed():
    global_object.num += 3

-and i put node(bob) from scene 1

3
second map name (new_world)

-button to increase number with code:

func _on_increase_pressed():
    global_object.num += 3

-put node(bob) from scene 1 here too

in Engine by (413 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.