Hello!
I started using AC recently and it's been fantastic. Really helps streamline interactions and a lot of the UI setup which I always struggle with. I'm working on a game with a friend right now and trying to add a combat system to this game. The game was originally set up in the point and click style, but I used the wizard was used to make it a 3D project with Direct input controls and gamepad support. Right now I'm trying to add some RE/Silent Hill style combat where the player is able to aim and fire while standing in place.
I added another action to the Input Action Asset and right now I'm trying to verify that the messages are firing accordingly. I've bound Shift and Left Trigger to a "ReadyWeapon" action, which prints a message to the debug log when my script (which is just on the Controls Reader prefab at the moment) receives the message. However, right now the message is only printing when I press Shift, and not when I press Left Trigger. I know my script is responding to the message, but for some reason it won't when I press left trigger. I know my game is recognizing the controller because in my test scene I'm able to move my character around and interact with test objects in my scene.
Is there something I need to do so that I get a response? Should I be adding my script to a different object or adding my action elsewhere so that the message fires correctly?
Thanks so much!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the communitym @jumadsen.
I've given things a try on my end, and the Log was printing for both input types. Have you mapped each input to their respective Control Scheme in the Input Actions window? If you can share screenshots of the Left Shift and Left Trigger mappings, I'll see if I can spot any issue.
AC likely isn't directly involved here, as ReadyWeapon isn't an AC input, and the script to detect it is a custom one. You could, however, try using AC to detect the input, by using this function:
Hey Chris!
Thanks so much and thank you for your patience - I did verify that the actions are mapped to their respective control schemes in the Input actions window(https://imgur.com/a/tEZaVTY). I did try opening a new scene in the project without running the scene organizer. If I put the Player Input component on a GameObject with the Combat script, then both inputs fire. However, if I run the AC Scene organizer in a new scene and transfer my script to the Controls Reader, the inputs will stop firing.
I think the issue may have something to do with how Unity is auto-switching between controls, as the debug fields under player input aren't registering the controller- they're showing as mouse and keyboard. Thanks for your suggestion, I'll keep that open as an option
Thanks for the details.
It does sound like a conflict of some sort - though the ControlsReader script generally doesn't affect anything outside of it, only reading data.
A few things to try - these won't be the "answer", but may help get to the bottom of things:
playerInput.actions.Enable ();