Error while calling variables in a script

Godot Version

v4.1.3.stable.official

Question

Hello, I am trying to load a .csv file then add the information from each row to an Array of type “Swimmer”. I skip the first row because those are the headers in the .csv. I then make the swimmer scene and assign it’s values based on the .csv.
My issue is that I get an error though when I try to get the swimmer_name of each “Swimmer” for example.

Swimmer scene is basic 2dnode with “class_name = Swimmer” and ‘swimmer_name’ variable, ‘stat1’ variable and ‘stat2’ variable.

Also why is there a ‘@Node@2’ scene made when I start the scene?

I hope it’s something simple I’ve missed… :face_exhaling:

Line 3: You assign the Swimmer script as initial value for your array.
It should be:

var all_swimmers : Array[Swimmer] = []

And I don’t see where you add the swimmers to the array?

Ahh ok. Did not know that, thanks!
And you are right… I didn’t append it lol

I’m not sure where the other node comes from. :smiley:

I had the scene as my main scene and the script on autoload as well :face_with_peeking_eye:
Thanks again!

You’re welcome! I see :laughing: I hope the swimmers can swim now :slight_smile:

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