Local Mutiplayer - Index/refrence

I am creating a local multiplayer game in which players can play split screen using one PC/Console with multiple controllers for different players. (Xbox 360)

So far I have a Game Mode BP which i have created players and them possessed that player using the player character index of 0 & 1 as shown below. This works fine for spawning 2 characters that control separate on different controllers. from this I’ve tried to make a variable that sets in different characters using “Character ID” as reference to which player it is.

I am then referencing this variable in the character’s and other Bp’s to reference different controllers and there corresponding pawn/character. Below i am trying to use the ID number to set up different colors for different players eg. Player 1 = green Player 2 = Blue and so forth.

Please help me if i am creating/ referencing players wrongly. I am new to setting up multiplayer and need help on how start creating referencing for local multiplayer.

Many Thanks
Harrison Lee

I am missing something here. whats not working ? is the color not applying ?

Can you tell me what is not working I don’t seem to be catching on here… sorry

I need a better understanding of this as well, as I am combining splitscreen local with networked multiplayer.

Engine creates 1 player out of the box so by calling “Create Player” you are creating 2nd and 3rd player, so there is already player with id 0. By looking on engine code:

https://github.com/EpicGames/UnrealEngine/blob/dbced2dd59f9f5dfef1d7786fd67ad2970adf95f/Engine/Source/Runtime/Engine/Private/GameInstance.cpp#L509

If you input ID 0 that already exist the creation of player would fail and you would get error in logs. Try using Set PlayerControler ID insted which has code that swaps IDs between them, but keep in mind you still gonna have extra PlayerController.

Note that you don’t need to use ID system if you have static number of players, you can just keep them in variables.

Thank you @Shadowriver. That makes things a little more clear.
The link you provided results in a 404 for me. would I be able to look at the GameInstance source code without downloading the source code version of Unreal?

Question: Why are you using your own ID variable instead of the built-in Controller ID that comes with each player controller? There’s nothing wrong with that approach but there might be some confusion if you were to set two things to the same ID, which I think the engine does not allow on its built-in controller ID (does it swap them if you try?), except for network remote controllers which all have the ID -1.