W
W
WasTabon2020-12-07 17:45:39
Unity
WasTabon, 2020-12-07 17:45:39

How to make a character move in the new Input System?

Here is the code

public class PlayeMoving : MonoBehaviour
{
    public Vector2 direction;
    public Rigidbody2D rb2D;

    public void Moving(InputAction.CallbackContext context)
    {
        direction = context.ReadValue<Vector2>();
        rb2D.MovePosition(direction);
    }
}


The character only moves once, you need to click further. And how to make movement in each frame?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daemonstergames, 2020-12-07
@Daemonstergames

Have you tried the Update method?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question