The class "AttackState" couldn't be fully loaded (script error or cyclic dependency).

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By phao

I encountered an error while scripting in Godot v3.5.2.
This is the code of ConditionEveryRound.gd:

extends Condition
class_name ConditionEveryRound

export var round_base : int = 1
export var round_delta : int = 1

func isChecked(attack_state:AttackState) -> bool:
	if attack_state.rounds - round_base % round_delta == 0:
		pass
	return false

And this is the code of AttackState.gd:

extends Resource
class_name AttackState

var rounds : int
var all_enemies : Array

Then I get the this error in ConditionEveryRound.gd:

error(7,1): The class "AttackState" couldn't be fully loaded (script error or cyclic dependency).

Why is this? How can I eliminate this error?

I don’t see any obvious problem, but typically that error occurs when a script A depends on another script B, and the B script has a syntax error in it or if script B also depends on script A. I would double check that AttackState.gd has no syntax issues, and make sure AttackState.gd does not required any dependency from ConditionEveryRound.gd

godot_dev_ | 2023-05-31 13:29