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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Handling Multiple Inputs/Controllers

Discussion in 'UGUI & TextMesh Pro' started by SnowDaySoftware, Sep 17, 2015.

  1. SnowDaySoftware

    SnowDaySoftware

    Joined:
    Mar 25, 2013
    Posts:
    11
    What is the best practice with developing a UI for a 4 player game? The EventSystem can only be set up for 1 controller in the input manager. Are we able to have multiple EventSystems and Canvases for each player? Something like in a fighting game, where 4 players are selecting the characters simultaneously. I'm not sure how to go about doing this.
     
  2. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    You would need to write your own Input Module, and possibly Event System for this. I've included the two I made some time ago for reference. It's probably not quite plug 'n play, but it was also for a multiplayer character select, so it might give you some idea of what to look at. Good luck!

    EDIT: Whoops, added in the wrong file by accident. StageSelectionInputModule changes the same cursor for both inputs; CharacterSelectionInputModule does what was described (for 2 players).
     

    Attached Files:

    Last edited: Oct 21, 2015
    SnowDaySoftware likes this.
  3. SnowDaySoftware

    SnowDaySoftware

    Joined:
    Mar 25, 2013
    Posts:
    11
    Thanks for the reply. So based off your scripts, did you just simulate a mouse cursor for each player? That is pretty much what I have been doing, but it seems so backwards. And also moving a fake mouse cursor on screen with the UI doesn't always have the smoothest movement. It works, but I don't love it.
     
    Senshi likes this.
  4. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    No problem. I wouldn't call it a mouse cursor, but essentially, yes. I used a square image overlay that was bound to a grid. So the "cursor" would start at the top-left and hitting right would make it slide to the grid cell to its right.