switch scenes without repeating variable values.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DylFar 25

I have 2 scenes, the main scene and the main menu. in the main scene there is a variable with a default value of 0. I make an action pressing a button and adding the value of the variable but when moving to the main menu and returning to the main scene the variable value returns to the default value of 0 how do I keep the variable value at the last value .

:bust_in_silhouette: Reply From: Asthmar

By using a singletons and creating a global variable. More on that here.


DylFar 25 | 2020-01-25 14:45