Hi all,
Hope everyone is having a great weekend!
I have a question about the best way to achieve the following:
I've set up all my QTEs with UI for Keyboard/Mouse, implemented controller inputs, and added a listener script that checks if a controller is connected at runtime. I'm currently in the process of adding controller UI elements to match all the keyboard counterparts.
My question is: what’s the best way to handle this?
Should I use the same UI element and switch the animator?
Should I add a "Link Variable to Animator" component, create a variable that activates when a controller is connected, and have all animators display alternative animations based on that?
Or should I just clone all the keyboard QTE UI elements and replace their animators with controller versions?
I’d really like to not have to clone all the UI elements just for controller inputs, but I’m unsure if "Link Variable to Animator" can work properly in conjunction with the Hit, Win, and Lose QTE states.
Thank you in advance, as always!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
As in, show a gamepad button instead of a keyboard key?
It would be best to use the same UI. Link Variable To Animator can be used - you can link it to a Bool variable that your listener script sets manually, i.e.:
The issue right now, though, is that the Hit/Win/Lose animations are currently played directly by naming convention - meaning they'll run regardless of any Animator parameter / transition.
It would, in hindsight, be better for these to be played via Trigger parameters instead, i.e. "Hit" is a Trigger that you can set up in your Animator to play your Hit animation. That way, you can add an additional "IsUsingGamepad" parameter condition in the Transition to play one of two different Hit animations based on the variable's value.
I'll look into making this change as part of the next update. You can make this change manually in the meantime by opening AC's PlayerQTE script and replacing all the instances of:
with:
Hi, Chris! Thanks for getting back so quickly. That'e exactly why I was asking. I know that Hit/Win/Lose play directly. Thank you for the workaround. I'll see what I can do. Have a wonderful day ahead.
No problem - let me know if it works!