# How to let second APlayerController use second Xbox controller input?

**URL:** <https://forums.unrealengine.com/t/how-to-let-second-aplayercontroller-use-second-xbox-controller-input/336549>\
**Category:** Character & Animation\
**Tags:** playercontroller, xbox-controller, unreal-engine, local-multiplayer, question\
**Created:** [October 26, 2015, 4:03pm UTC](https://forums.unrealengine.com/t/how-to-let-second-aplayercontroller-use-second-xbox-controller-input/336549 "2015-10-26T16:03:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [October 26, 2015, 4:03pm UTC](https://forums.unrealengine.com/t/how-to-let-second-aplayercontroller-use-second-xbox-controller-input/336549/1 "2015-10-26T16:03:27Z")

</div>

I have two pawns in my level, and I want each to be controlled by a different xbox controller. They both share the same camera. Right now the first pawn works fine and I setup the controls like this…

```
    m_pCont1 = GetWorld()->GetFirstPlayerController();
    m_pCont1->Possess(m_pPawn1);
    m_pCont1->SetViewTarget(m_pCamera);

```

And this will eventually call into Pawn1’s SetupPlayerInputComponent() method as expected.

To set up the second pawn, I am using this code:

```
    m_pCont2 = GetWorld()->SpawnActor<APlayerController>();
    GetWorld()->AddController(m_pCont2);
    m_pCont2->Possess(m_pPawn2);
    m_pCont2->SetViewTarget(m_pCamera);

```

But Pawn2’s SetupPlayerInputComponent() method is never called. I read from other posts that a second playercontroller should automatically receive input from a second Xbox controller.

Any suggestions would help, I think I might using the wrong code to setup a new PlayerController.

---

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [October 26, 2015, 5:24pm UTC](https://forums.unrealengine.com/t/how-to-let-second-aplayercontroller-use-second-xbox-controller-input/336549/2 "2015-10-26T17:24:25Z")

</div>

Update: I changed the way I spawned the APlayerController to…

```
m_pCont2 = GetWorld()->GetAuthGameMode()->SpawnPlayerController(ENetRole::ROLE_None, FVector::ZeroVector, FRotator::ZeroRotator);
m_pCont2->Possess(m_pPawn2);
m_pCont2->SetViewTarget(m_pCamera);

```

But this still does not work :[

And I am able to possess/control the second pawn, but only the first APlayerController that I received from UWorld::GetFirstPlayerController(). And of course if I possess the second pawn, i no longer control the first pawn.

---

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [October 26, 2015, 7:05pm UTC](https://forums.unrealengine.com/t/how-to-let-second-aplayercontroller-use-second-xbox-controller-input/336549/3 "2015-10-26T19:05:48Z")

</div>

Okay, I finally got both controllers working but I used a different strategy. Instead of having the pawns already placed in the level, I placed some PlayerStarts and then in my custom GameMode, I switched the DefaultPawn member to my custom class that inherited from APawn. Then in my custom GameMode class I used the UGameplayStatics::CreatePlayer() function to spawn the pawns/playercontrollers. And this time, the input bindings were set up properly for each pawn.
