Variables after get_tree.change_scene

Godot Version

4.2.2

Question

hello, im not sure if its good category
i want to make options in my game but i dont know how,
my problem in graphic

you can use either “static” variables or a global-script/autoload.
Autoloads are always active and dont disappear when you change scene

autoloads? is it the same as globalscript? EDIT: yes

and what is “static” variable

static variables are “Class”-variables. They are the same for every instance of that class and can be called from everywhere, e.g.:

class_name Menu extends Control

static var screen_resolution: Vector2

# Other script
func change_resolution(resolution: Vector2):
    Menu.screen_resolution = resolution

Its fairly similar to autoloads, just instead of a full script its only the methods and variables marked with “static”

oh thats ultra usefull thank you very much

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.