Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by BrunoBelvedere · Jun 12, 2020 at 10:00 AM · input manager

New input system local multiplayer: move the second player

Hi,

This is my first post here on the forum, please let me know if I break any rules.

I'm currently trying to move from the old input system to the new input system. I have two players on the screen at the same time. One should be controlled by WASD+Spacebar, another by ARROWS+Numpad0.

What I did was to create 2 ActionMaps. One called PlayerOne and the other PlayerTwo: alt text Each player has the correct ActionMap configured on the editor instance: alt text

The problem is: When both of them are present on the same scene, only Player_1 works. Player_2 events aren't even called. Testing, I deleted the Player_2 prefab from the scene and then changed the Player_1 controls to PlayerTwo ActionMap (the one which should control the player two) and surprisingly it works as expected, player_1 is now controlled by ARROWS+Numpad0.

Am I missing something?

Here is the implementation of Player_1 and Player_2:

  private Vector2 _iMovement;
         private void Update()
         {
             HandleMovement();
         }  
      
     private void OnMove(InputValue value)
         {
             _iMovement = value.Get<Vector2>();
         }
      
         private void HandleMovement()
         {
             var direction = new Vector3(_iMovement.x, _iMovement.y);
      
             transform.Translate(direction * (speed + _speedBonus) * Time.deltaTime);
      
             transform.position = new Vector3(transform.position.x, Mathf.Clamp(transform.position.y, -4, 0));
      
             if (transform.position.x >= 11.1)
                 transform.position = new Vector3(-11.1f, transform.position.y, 0);
             else if (transform.position.x <= -11.1)
                 transform.position = new Vector3(11.1f, transform.position.y, 0);
      
         }


2.png (58.2 kB)
1.png (28.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Zoltantan · Jun 16, 2020 at 06:12 PM

@BrunoBelvedere Well, although this won't solve your problem, I experienced a somewhat similar problem. On the pre-version it was working fine but on the latest the second controller won't fire any events.

Anyways you don't need separate ActionMaps. One should be enough, please check this https://www.youtube.com/watch?v=D8nUI88POU8 ( title: New Input System With Local Multiplayer in Unity ).

Also, make sure that you have separate ControlScheme for Keyboard/Controller.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by MrWhiteGorilla · Nov 09, 2020 at 12:55 PM

hello there I am facing the same problem at the moment and I couldn't solve it I just discovered that when you ever add a second player the input for the first player will not send I still I didn't figure it out please could you f you solve this problem to share the solution of it

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image BrunoBelvedere · Nov 09, 2020 at 02:37 PM 0
Share

Hey @$$anonymous$$rWhite$$anonymous$$illa , I'm not working on this project anymore, but if I remember, you cannot use the same input device for both (or more) players at the scene. That is, one should be using the keyboard, other a gamepad or whatever. I'm not really sure if that's a bug or it should really behavior like that. I remember I searched for it at the time and discovered It wasn't possible. What I did was to keep up with the old methods for controlling the players, unfortunately. Please, let me know if you manage to fix this somehow.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

205 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to get maximum value of a direction working with Joysticks? 1 Answer

how can I instantiate bullet prefabs continuously while holding the left mouse button? ,how can I instantiate bullet prefabs continuously while holding the left click button? 0 Answers

VR stick action inputs 0 Answers

My debug keyboard inputs aren't working as soon as I start unity remote 0 Answers

Unity's Explorer 3D Game Kit on Mobile! 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges