[UPDATE]: This was user error. I was swapping the action map in the started method so it never had a chance to call performed. Can’t figure out how to delete this post or I would.
I want to do one thing when a button is pressed and an additional thing if it is held. I figured the way to do this would be do the first thing on started
and then using a Hold interaction and doing the other thing on performed
but everything I’ve tried is telling me it’s only allowed to be one or the other. This can’t be the case which is why I’ve logged this as a bug.
I just swapped over to generating a C# class based on my Input Actions asset and built an input manager around it. In the Input Actions asset my action is set to Hold with the default settings. I’ve tried subscribing to both .started and .performed to the same method and doing a check inside of it:
private void SomeMethod(InputAction.CallbackContext context)
{
if (context.started)
//do something
if (context.performed)
//do an additional thing
}
This results in the code within the started section running and never hitting performed. If I remove the line where this method is subscribing to started and only leave the one where it subscribes to performed, it calls performed but not started.
So then I tried to break it into two separate methods. Ex: input.started calls one method while input.performed calls another. Exact same thing happens as before—if I’m subscribing to both started and performed, only started gets called. If I comment out the subscription to started, performed will get called. Here’s a code example just for kicks:
private void CalledOnStarted(InputAction.CallbackContext context)
{
//do something
}
private void CalledOnPerformed(InputAction.CallbackContext context)
{
//do an additional thing
}