Resource Parse Error: Non Existent

Godot Version

4.2.2

Question

I get a the following error:
Parse Error: [ext_resource] referenced non-existent resource at: res://Units/Cards/card_resource.gd

I read that this is due to Cyclic references. So I removed all places where CardResource is referenced. I still get the error, but the can’t be any cyclic dependency left I think.
Any Idea to fix the Project would be lovely (I could send you the complete Project if that helps)

class_name CardResource
extends Resource

enum CardTarget {
	TILE,
	UNIT,
	ENEMY_UNIT,
	FRIEND_UNIT,
	SELF,
}

@export var name: String
@export var rarit = 0#: Rarity.Type = Rarity.Type.COMMON
@export var reach: int = 1
@export var ap_cost: int = 1
@export var fatigue_cost: int = 1
@export var effects: Array#Array[CardEffect]
@export var exile: bool = false
@export_range(0, 5) var charge: float = 0

# Should this card be used for auto attacks
var auto_attack: bool = false


func needs_target() -> Target.Type:
	var target: Target.Type = Target.Type.NONE
	
	
	for effect in effects:
		target = Target.merge_targets(target, effect.needs_target())
	# Remove caster because they shouldn't be exported as target
	if target == Target.Type.CASTER:
		target = Target.Type.NONE
	
	return target

You need to search the whole code base. There could also be references in the .tscn files. Do you have a fancy text editor, like vs code, or good with the command land? What is your OS?

1 Like

Thanks for your Reply!
I use the default code editor, Linux and am ok with the Command line.
With Grep I found where CardResource is mentioned.

I found a solution with the following Method:

  1. Comment out all type hints from the Problem Class (For me CardResource)
  2. Add types back in, and test for each if the Game still works
    2.1 If a type causes an error go in the file for that type and start at 1 or just don’t add the type hint.

To be honest it solved it, but I don’t understand why :sweat_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.