![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | sygi |
I have a following autoloaded class A:
extends Node
var asdf = null
func _ready():
set("asdf", "test")
and another node B somewhere else in the tree:
extends Node
func _ready():
print(A.asdf)
The code then works fine and prints test
. However, I’d like to add different fields programmatically without explicitly listing them first, eg.:
extends Node
func _ready():
set("asdf", "test")
However, when I do this:
extends Node
func _ready():
print("asdf" in A)
print(A.asdf)
I’m getting False
and and invalid_get_index
. Is it possible to access the dynamically-created fields in autoloaded classes?