+1 vote

When i instance a inner class from my autoload whether its in the autoload or another scene i always get two reference.

class Card:
var name: String
var description: String
var energy_cost: int
var effect_one: String
var effect_two: String

func _init(name, description, energy_cost, effect_one, effect_two):
    self.name = name
    self.description = description
    self.energy_cost = energy_cost
    self.effect_one = effect_one
    self.effect_two = effect_two

# effect
# d = damage
# b = block
# n = none

func _ready():
# create the cards in the game
card_strike = Card.new("Strike", "Deal 5 damage", 1, "d5", "n")
card_defend = Card.new("Defend", "Gain 5 block", 1, "b5", "n")

when i print it i get this


and when i add it to an array i get this


and when i try to add multiple to an array i get this

[[Reference:1271], [Reference:1271], [Reference:1271], [Reference:1271], [Reference:1271]]
[[Reference:1274], [Reference:1274], [Reference:1274], [Reference:1274], [Reference:1274]]

when the class is not in a autoload i only get one reference, why is this happening and how can i fix it?

Godot version 3.5.1
in Engine by (13 points)

Where was card_strike introduced?
I see it is without a varkeyword in code, so it must have been introduced in different scope? It must be there when issue happens

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.