Iterate through custom map does not work

I have a class called “gungame_player”
This class has an Attribute “Name”

gungame_player<public> := class():
    var Score : int = 0
    var Setbacks : int = 0
    var Kills : int = 0
    var Killstreak : int = 0
    var Name<public> : string = ""
    var UIButton : button_loud = button_loud{}

    Player<public> : player
    GungameManager<public> : game_manager_device
    FortChar<public> : fort_character
    Bots<public> : []sentry_device
    Agent<public> : agent

in my Game manager, i have a map containing several Gungame Players

 var Players : [agent]gungame_player = map{}

When i log the length of the Players array, i get 1 (Which is correct, as i am the only player there)

But when i want to iterate through the Map and output the Name, i get an error

 for(Key->Value : Players):
    Print("Test {Value.Name}")

This is the error:

Unknown(1,1) 2023.05.18-22.12.41:816:[VerseRuntimeErrors] Internal error encountered.

Vs code shows me, that Key is an agent type and Value is gungame_player

Should’t i be able to access the name then ?

Guessing it’s not the variable name “Name” conflicting with something? Tried renaming it?

I found out, that on setting a new player inside the array, the player was not set and the value was basically “None”.

So although the length of the Array was 1, there was no real player inside it

2 Likes

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