![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | mdubaisi |
I made a class_name
but when I want to create an instance of it, it gives me these errors:
built-in:17 - Parse Error: The class "Pokemon" couldn't be fully loaded (script error or cyclic dependency)
modules/gdscript/gdscript.cpp:599 - Method failed. Returning: ERR_PARSE_ERROR
this is the code for the class_name
:
extends TextureButton
class_name Pokemon
var pokemon_name = ""
var stage = ""
var evolution_stage = ""
var health = 0
var type = ""
var attacks = []
func _init(var p_name, var s, var e_stage, var h, var t, var a):
pokemon_name = p_name
stage = s
evolution_stage = e_stage
health = h
type = t
attacks = a
in fear of sounding arrogant, it means just what it says. you have a class called Pokemon which could not be fully loaded. this might mean that there is a formatting/indentation error in the file class, if you look at your pokemon script-file there might be a red marker showing you what’s wrong with the script.
there might also be a conflict in naming, where it is referred to with different names between the file-system (what the file-name is) and the internal refference
nyan | 2021-02-10 16:43
Could you show us the code where this class is used? Btw, when the keyword class_name
is used, the class script doesn’t have to be manually loaded by the script; the editor automatically makes the class script available to other scripts.
Ertain | 2021-02-10 16:17