Forum rules - please read before posting.

Input method auto switch help

Hello. I'm doing finishing touches to my game, and currently adding controller support. All is mostly well while setting up the "Keyboard or Controller" input method, but I'm not satisfied with the simulated cursor that the mouse is obligated to use. I've seen that there's a script that is supposed to allow hotswapping input methods based on your last input, but I didn't seem to implement it correctly, or maybe it just doesn't work (I put the script on a gameobject, but all it did was make me unable to click on menus).
I found an example of the script here: https://www.adventurecreator.org/forum/discussion/11065/auto-detecting-mouse-and-or-controller-input

From what I gathered, it's supposed to listen to the event "isMouse", and swap if it, or anything else happens?

So first of all I'd like to know if there was some nuance to its implementation that I missed.
And secondly, I'd like to know if it's not possible to instead listen to a controller input, with the "else" swapping it to Mouse and Keyboard?

I hope it was clear enough.

Unity version: 2021.3.11f1
AC Version: 1.78.4 (not the latest I know)

Comments

  • A more recent version of the example script can be found on the AC wiki here:

    https://adventure-creator.fandom.com/wiki/Switching_input_method_dynamically

    This script involves listening to a specific input to switch to Keybord Or Controller, so you can define multiple instances of e.g. "JoystickButton" and map them each to your various controller buttons ("joystick button 0", "joystick button 1" etc.

    When switching to Keyboard Or Controller, the script also switches menu navigation to Direct-control - meaning you use the gamepad/arrow-keys to select buttons. You can alter the script as necessary if needed, but I'd suggest first making a note of what Manager field values work best for your needs with Keyboard Or Controller mode alone - before introducing the swapping mechanic.

    It's also worth mentioning that Unity's Input System allows you to define Control Schemes that rely on different inputs for different devices. An integration package between AC and Input System can be found on the Downloads page.

  • Okay thank you. I should really look at the AC wiki more often x)
    Works as intended, and I managed to tweak it to my needs.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.