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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

[FİXED] Getting error when click 2 movement button at the same time

Discussion in 'Input System' started by akadird, Jul 25, 2020.

  1. akadird

    akadird

    Joined:
    Dec 19, 2017
    Posts:
    11
    I'm using New Input System for my top-down RPG movement. It works when i click the WASD one by one but if i click 2 of them togather like A and S for left down it gives this Error:

    My Input Controller


    My Code:
    Code (CSharp):
    1. public class CharacterMovement : MonoBehaviour
    2. {
    3.     [SerializeField] private float moveSpeed = 5f;
    4.     [SerializeField] private Rigidbody2D rb;
    5.     private Vector2 movement;
    6.  
    7.     private void FixedUpdate()
    8.     {
    9.         rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
    10.     }
    11.  
    12.     private void OnMovement(InputValue value)
    13.     {
    14.         Vector2 mevementInput = value.Get<Vector2>();
    15.         movement = mevementInput;
    16.     }
    17. }

    its still work how it should be but i really hate this error.
     
  2. akadird

    akadird

    Joined:
    Dec 19, 2017
    Posts:
    11
    Changing Action type "Value" to "Pass Through" fix the problem. Sorry to bother :D