Unity, character selection screen on same PC by two players












0















The game I am trying to make include local multiplayer to play on same PC. I have done by making the different controllers in input manager and game work perfectly fine.



But now I am onto the part where I have to create a character selection screen for multiple player on same PC. I am beginner to the unity and learning right now. So I have no idea how to make it happen. Because when I tried to make it unity UI didn't able to take two input. At a time



I have also watched some of the threads in which people suggested to make your own eventsystem and button but I tried doing that somehow buttons are not taking any response they are not clickable. If anyone has seen those thread and that method is working for them, so please let me know how to.make it work



Or if someone has any other idea how to do please let me know



Thanks in advance










share|improve this question























  • Could you provide code or screenshots of your current attempt?

    – Skdy
    Nov 20 '18 at 7:35











  • Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

    – Skdy
    Nov 20 '18 at 7:37
















0















The game I am trying to make include local multiplayer to play on same PC. I have done by making the different controllers in input manager and game work perfectly fine.



But now I am onto the part where I have to create a character selection screen for multiple player on same PC. I am beginner to the unity and learning right now. So I have no idea how to make it happen. Because when I tried to make it unity UI didn't able to take two input. At a time



I have also watched some of the threads in which people suggested to make your own eventsystem and button but I tried doing that somehow buttons are not taking any response they are not clickable. If anyone has seen those thread and that method is working for them, so please let me know how to.make it work



Or if someone has any other idea how to do please let me know



Thanks in advance










share|improve this question























  • Could you provide code or screenshots of your current attempt?

    – Skdy
    Nov 20 '18 at 7:35











  • Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

    – Skdy
    Nov 20 '18 at 7:37














0












0








0








The game I am trying to make include local multiplayer to play on same PC. I have done by making the different controllers in input manager and game work perfectly fine.



But now I am onto the part where I have to create a character selection screen for multiple player on same PC. I am beginner to the unity and learning right now. So I have no idea how to make it happen. Because when I tried to make it unity UI didn't able to take two input. At a time



I have also watched some of the threads in which people suggested to make your own eventsystem and button but I tried doing that somehow buttons are not taking any response they are not clickable. If anyone has seen those thread and that method is working for them, so please let me know how to.make it work



Or if someone has any other idea how to do please let me know



Thanks in advance










share|improve this question














The game I am trying to make include local multiplayer to play on same PC. I have done by making the different controllers in input manager and game work perfectly fine.



But now I am onto the part where I have to create a character selection screen for multiple player on same PC. I am beginner to the unity and learning right now. So I have no idea how to make it happen. Because when I tried to make it unity UI didn't able to take two input. At a time



I have also watched some of the threads in which people suggested to make your own eventsystem and button but I tried doing that somehow buttons are not taking any response they are not clickable. If anyone has seen those thread and that method is working for them, so please let me know how to.make it work



Or if someone has any other idea how to do please let me know



Thanks in advance







user-interface unity3d multiplayer






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 2:31









Paras SharmaParas Sharma

84




84













  • Could you provide code or screenshots of your current attempt?

    – Skdy
    Nov 20 '18 at 7:35











  • Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

    – Skdy
    Nov 20 '18 at 7:37



















  • Could you provide code or screenshots of your current attempt?

    – Skdy
    Nov 20 '18 at 7:35











  • Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

    – Skdy
    Nov 20 '18 at 7:37

















Could you provide code or screenshots of your current attempt?

– Skdy
Nov 20 '18 at 7:35





Could you provide code or screenshots of your current attempt?

– Skdy
Nov 20 '18 at 7:35













Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

– Skdy
Nov 20 '18 at 7:37





Also can you elaborate on "unity UI didn't able to take two input. At a time" :)?

– Skdy
Nov 20 '18 at 7:37












1 Answer
1






active

oldest

votes


















0














As far as I know, you CAN'T have more than one event system in the same scene.
So knowing that I'll suggest to change the...perspective about your game, here is something that can work:



You can't have more than one input on the same UI, but you can distinguish "keyboard" inputs. So let's guess the scenario that you have the screen divided in 2 parts, where left side is the Player 1 selection character, and can select between 2 characters, and right side is the Player 2 selection character, with the same number (or different, as you want!) of possible characters.



The pseudo code will be something like:



private Player m_player1;
private Player m_player2;

private CharacterSelection m_CharacterSelection_Player1;
private CharacterSelection m_CharacterSelection_Player2;

If (m_Player1.Input.GetKeyDown(KeyCode.A))
{
m_CharacterSelection_Player1.Left();
}
else if(m_Player1.Input.GetKeyDown(KeyCode.D)){
m_CharacterSelection_Player1.Right();
}

If (m_Player2.Input.GetKeyDown(KeyCode.LeftArrow))
{
m_CharacterSelection_Player2.Left();
}
else if(m_Player1.Input.GetKeyDown(KeyCode.RightArrow)){
m_CharacterSelection_Player2.Right();
}


Here is the visual representation about what I'm trying to tell you:
enter image description here






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385380%2funity-character-selection-screen-on-same-pc-by-two-players%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As far as I know, you CAN'T have more than one event system in the same scene.
    So knowing that I'll suggest to change the...perspective about your game, here is something that can work:



    You can't have more than one input on the same UI, but you can distinguish "keyboard" inputs. So let's guess the scenario that you have the screen divided in 2 parts, where left side is the Player 1 selection character, and can select between 2 characters, and right side is the Player 2 selection character, with the same number (or different, as you want!) of possible characters.



    The pseudo code will be something like:



    private Player m_player1;
    private Player m_player2;

    private CharacterSelection m_CharacterSelection_Player1;
    private CharacterSelection m_CharacterSelection_Player2;

    If (m_Player1.Input.GetKeyDown(KeyCode.A))
    {
    m_CharacterSelection_Player1.Left();
    }
    else if(m_Player1.Input.GetKeyDown(KeyCode.D)){
    m_CharacterSelection_Player1.Right();
    }

    If (m_Player2.Input.GetKeyDown(KeyCode.LeftArrow))
    {
    m_CharacterSelection_Player2.Left();
    }
    else if(m_Player1.Input.GetKeyDown(KeyCode.RightArrow)){
    m_CharacterSelection_Player2.Right();
    }


    Here is the visual representation about what I'm trying to tell you:
    enter image description here






    share|improve this answer




























      0














      As far as I know, you CAN'T have more than one event system in the same scene.
      So knowing that I'll suggest to change the...perspective about your game, here is something that can work:



      You can't have more than one input on the same UI, but you can distinguish "keyboard" inputs. So let's guess the scenario that you have the screen divided in 2 parts, where left side is the Player 1 selection character, and can select between 2 characters, and right side is the Player 2 selection character, with the same number (or different, as you want!) of possible characters.



      The pseudo code will be something like:



      private Player m_player1;
      private Player m_player2;

      private CharacterSelection m_CharacterSelection_Player1;
      private CharacterSelection m_CharacterSelection_Player2;

      If (m_Player1.Input.GetKeyDown(KeyCode.A))
      {
      m_CharacterSelection_Player1.Left();
      }
      else if(m_Player1.Input.GetKeyDown(KeyCode.D)){
      m_CharacterSelection_Player1.Right();
      }

      If (m_Player2.Input.GetKeyDown(KeyCode.LeftArrow))
      {
      m_CharacterSelection_Player2.Left();
      }
      else if(m_Player1.Input.GetKeyDown(KeyCode.RightArrow)){
      m_CharacterSelection_Player2.Right();
      }


      Here is the visual representation about what I'm trying to tell you:
      enter image description here






      share|improve this answer


























        0












        0








        0







        As far as I know, you CAN'T have more than one event system in the same scene.
        So knowing that I'll suggest to change the...perspective about your game, here is something that can work:



        You can't have more than one input on the same UI, but you can distinguish "keyboard" inputs. So let's guess the scenario that you have the screen divided in 2 parts, where left side is the Player 1 selection character, and can select between 2 characters, and right side is the Player 2 selection character, with the same number (or different, as you want!) of possible characters.



        The pseudo code will be something like:



        private Player m_player1;
        private Player m_player2;

        private CharacterSelection m_CharacterSelection_Player1;
        private CharacterSelection m_CharacterSelection_Player2;

        If (m_Player1.Input.GetKeyDown(KeyCode.A))
        {
        m_CharacterSelection_Player1.Left();
        }
        else if(m_Player1.Input.GetKeyDown(KeyCode.D)){
        m_CharacterSelection_Player1.Right();
        }

        If (m_Player2.Input.GetKeyDown(KeyCode.LeftArrow))
        {
        m_CharacterSelection_Player2.Left();
        }
        else if(m_Player1.Input.GetKeyDown(KeyCode.RightArrow)){
        m_CharacterSelection_Player2.Right();
        }


        Here is the visual representation about what I'm trying to tell you:
        enter image description here






        share|improve this answer













        As far as I know, you CAN'T have more than one event system in the same scene.
        So knowing that I'll suggest to change the...perspective about your game, here is something that can work:



        You can't have more than one input on the same UI, but you can distinguish "keyboard" inputs. So let's guess the scenario that you have the screen divided in 2 parts, where left side is the Player 1 selection character, and can select between 2 characters, and right side is the Player 2 selection character, with the same number (or different, as you want!) of possible characters.



        The pseudo code will be something like:



        private Player m_player1;
        private Player m_player2;

        private CharacterSelection m_CharacterSelection_Player1;
        private CharacterSelection m_CharacterSelection_Player2;

        If (m_Player1.Input.GetKeyDown(KeyCode.A))
        {
        m_CharacterSelection_Player1.Left();
        }
        else if(m_Player1.Input.GetKeyDown(KeyCode.D)){
        m_CharacterSelection_Player1.Right();
        }

        If (m_Player2.Input.GetKeyDown(KeyCode.LeftArrow))
        {
        m_CharacterSelection_Player2.Left();
        }
        else if(m_Player1.Input.GetKeyDown(KeyCode.RightArrow)){
        m_CharacterSelection_Player2.Right();
        }


        Here is the visual representation about what I'm trying to tell you:
        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 8:22









        LotanLotan

        1,150215




        1,150215






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385380%2funity-character-selection-screen-on-same-pc-by-two-players%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents