Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bayaola | |
Old Version | Published before Godot 3 was released. |
i am trying in my gscript file “name.gd” to do:
class A:
func _init():
pass
func a_function():
var new_A = A.new() # <= Here
it’s not working: Parser Error: Identifier not found: A
Looks like a bug/unsupported feature in GDScript. Recursive classes should be possible. I bet there is an issue on Github about this but didn’t searched yet.
Zylann | 2016-12-03 15:04
Doing this:
class A:
func _init():
pass
class A:
func _init():
pass
func a_function():
var new_A = A.new() #uses the second A
Should work, but yes, looks like a bug…
There’s the option to use a separate file and loading it inside the same file for recursive access.
eons | 2016-12-04 10:11