Skip to content

Instantly share code, notes, and snippets.

@freehuntx
Last active July 31, 2024 19:05
Show Gist options
  • Save freehuntx/b77d33058e1dffe121e29988783393d4 to your computer and use it in GitHub Desktop.
Save freehuntx/b77d33058e1dffe121e29988783393d4 to your computer and use it in GitHub Desktop.
Godot globalz - Simple globals class
class_name Globalz
static var _globals := {}
static func write(key: String, value: Variant) -> void:
_globals[key] = value
static func read(key: String) -> Variant:
return _globals.get(key)
static func has(key: String) -> bool:
return key in _globals
static func delete(key: String) -> void:
_globals.erase(key)
func _init():
print(Globalz.read("some.key"))
Globalz.write("some.key", "value")
print(Globalz.read("some.key"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment