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.

Resolved Play Method every frame button is pressed.

Discussion in 'Input System' started by lolsu_de, Jul 7, 2020.

  1. lolsu_de

    lolsu_de

    Joined:
    Nov 15, 2019
    Posts:
    3
    I recently switched to the new Input System and now I've got a problem. I've got an Input-Action with the Type: Value and Control Type: Vector 2. Everything works how it should work, however now I want that every frame, as long as the the user presses the buttons that are used to composite the Vector 2, my method, that uses the Vector 2, gets called. Thanks in advance.
     
  2. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    ATM there's no support for callbacks getting continuously called even if there's no input. The easiest way to do these kind of responses in generally is to poll.

    Code (CSharp):
    1. public void Update()
    2. {
    3.     var move = playerInput.actions["move"].ReadValue<Vector2>();
     
  3. lolsu_de

    lolsu_de

    Joined:
    Nov 15, 2019
    Posts:
    3
    Thanks! Works like a charm