0
\$\begingroup\$

When I first used it I remembered it as always calling the specific method once. So if I created a Jump Action with the key binding of space using SendMessage: enter image description here

enter image description here

and then created a method for it:

 public void OnJump(InputValue value)
 {
 Debug.Log("Jump");
 }

it would be called once when I press space, and indeed it does. It gets called once each time. But if I where to add movement with action type value and control type Vector2: enter image description here

it gets called more than once, it gets called twice. Once when I start pressing down the key and once when I release the key. I don't remember that being the case, am I just dumb or did they change it? I always remembered it as getting called once. And I can't find where in the documentations you can read about when and how this stuff gets called.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I think I am just dumb. It has probably always been like this. From my understanding Action types of type value are triggered whenever the value changes. When you press down W, the value changes, when you release it the value also changes, hence we get 2 Debug.Logs. Thats probably the answer.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.