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:
Each player has the correct ActionMap configured on the editor instance:
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);
}