Right now I create 2 players in one level, after the level is finished I pass data from all players to an array in a game instance by their index (The index is the order in which the players were spawned). When I switch level and create 2 players, the players fetch the data saved for the index(order in which they were spawned) fromt the game instance.
With 2 characters it works. My keyboard is index 0 and my gamepad is index 1.
(Game example) Player with keyboard has 50% hp in first level, and the player with gamepad has 70% hp. When I switch level right now this works. The player with keyboard still has 50% hp and player with gamepad has 70%
My question now is, what happens when I plug in 2 more controllers and spawn 2 more characters (I don’t have 2 more controller that’s why this question exists).
If I spawn 4 players and keep their index by order of spawn and save data to the game instance. And go to the next level and spawn 4 characters again will the same gamepad have access to the same data from the game instance with this logic?