Download

What is the player index in player controller?

I was casting to the player then noticed the player index was 0 by default.
What is the use of it?

It is just a default value, any count starts from zero :kissing_smiling_eyes:
You can change it if it will be needed

What is the use of changing it??
If I change to 5 what will happen??

If you change it to 5, you won’t find the player’s controller because by default it is equal to 0.

It canbe used to have several , for example for local multiplayer

Hardcoding to PlayerIndex 0 is one of the best ways to hang yourself in Unreal. But hey most or all Epic and YouTube learning tutorials let users do just that - go figure… Anyway try and never use the default of 0, and always assign a variable that you can set centrally in core code. That way if you add online or local-multiplayer later, or your own custom AI for testing or improving gameplay (even just temporarily), you don’t point gun at foot. :stuck_out_tongue:

1 Like