Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Local Multiplayer, Assigning a controller to each team

Discussion in 'Input System' started by Adham9, Jun 17, 2020.

  1. Adham9

    Adham9

    Joined:
    Nov 27, 2019
    Posts:
    18
    Hello,

    I have an environment of two opposing teams, and I managed to map the actions using the new input system through a PS4 controller. Now, both teams move when I use Controller A or Controller B. I want to assign one controller to team 1 and another controller to team 2 using code as the editor's "Player Input" component does not help in my case.

    I have searched the forum but did not find a solution for my case.
    Any help is highly appreciated.
     
  2. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Are you using "Generate C# Class"? If so, see here.
     
    Adham9 likes this.
  3. Adham9

    Adham9

    Joined:
    Nov 27, 2019
    Posts:
    18
    Thanks a million. That what I was looking for.
     
  4. SuperPox

    SuperPox

    Joined:
    Apr 29, 2020
    Posts:
    12
    Is "Generate C# Class" the only/best way to do local coop? I already programmed my character in with the Unity Events Behavior and am having the same problem where both controllers move Player 1 and I need to separate them out to P1 and P2.
     
  5. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Easiest way is using PlayerInput (see "Simple Multiplayer" sample).

    Are you using PlayerInput? If so, have you set up control schemes?