Skorpyo
(Skorpyo)
October 20, 2021, 3:42am
1
I want to loop through the Player Array for a ready button. The array is populated and the For Loop runs but doesn’t put out anything.
While searching for a solution I found out that I could get elements from the array with the Random function but not with the Get function.
What is happening?
If random works, and get doesn’t, then you’re supplying an out of bound index to the get node.
Also, don’t always rely on the debugger. Sometimes it will say one thing, but printing the output will tell you something else.
Skorpyo
(Skorpyo)
October 20, 2021, 8:27am
3
I’m using the index provided by random for the get function, that should result in the same item from the array. Printing the output results in an empty string.
The loop goes through the array and prints the correct index but doesn’t print out the player state.
Ah, sorry, not a clear picture.
I can tell you that the GET will not use the same index as the RANDOM, because you are in fact calling it twice.
This, for instance, won’t work:
Even so, I agree, it should choose a valid index, but it will probably not be the same one.
1 Like
Skorpyo
(Skorpyo)
October 20, 2021, 2:51pm
5
I tested it in the first person template and added a gamestate blueprint, a loop and started it with two players. The loop runs twice but doesn’t give the player state.
Skorpyo
(Skorpyo)
October 20, 2021, 3:08pm
6
I found the problem, it is a bug in UE5
Hey guys,
I found an issue in UE5 Preview 2. Its easy to replicate, if you try and get a Player State from the Players Array that is found in the Game State (This is a build in Array of all player states in the game) the result is always not valid, even if the index is valid.
The player state is valid if you get it in the player character blueprint. So the state is valid. And if you use Find Item from the Players Array from the game state and plug in the Player State variable from the player c…
1 Like