Forum rules - please read before posting.

Controls Reader events

edited March 2023 in Technical Q&A

Hello, I'm trying to make my game fully playable with both gamepad and mouse and keyboard, with diverse changes automatically made when another input type is detected. But I'm having a few issues with AC's control reader.

The biggest problem right now is about Control Reader's input change events - it seems that despite inheriting from UnityEngine.InputSystem.PlayerInput, Controls Reader cannot send events like InputSystem.onDeviceChange and InputUser.onChange, which offer more information than its OnSetControlScheme, which only returns a string and is limited by the Input Method in Settings.
My project uses a combination of UCC and AC, and the UCC character has a Player Input component attached as well. There is no conflict between the two however, usually two Player Input in the same scene will freeze but it seems that the Controls Reader component is different. Still I would need UCC's to be disabled at specific moments and AC's to be able to detect input type changes on its own with the same events.

One more thing, less important : on a test project the Control Reader's events displayed in the inspector have dynamic parameter types written between parentheses, like "OnSetControlScheme (string)", but on my current project the parameter and the parentheses are missing, it's just "OnSetControlScheme". The dynamic parameter remains usable nonetheless, it's just a UI display issue, and it might be Unity related. Both projects use 2022.2.9f1 and the latest versions of Input System, AC and its Input System integration.

Thanks in advance if anyone can help me with the first issue !


  • Thanks for the details. Could you share screenshots showing the way your ControlsReader Inspector is set up, such that such events aren't being fired? I'll attempt a recreation.

    The dynamic parameter remains usable nonetheless, it's just a UI display issue, and it might be Unity related.

    Unity handles the way event boxes are rendered, but it's not so clear-cut if both projects have the same Unity version. In each case, are you referencing a function on a GameObject in the scene?

  • edited March 2023

    Well the Controls Reader is left as it is, you can try by simply dragging the prefab into the scene. I left its Actions filled with the "Controls" Input Action Asset, and tried setting the Notification Behavior to all 4 options, but it gave no result.

    Here is the event that can be received with ordinary Player Input components :

    Just write this in start or awake :

    InputUser.onChange += onInputDeviceChange;

    And then create a void like :

    void onInputDeviceChange(InputUser user, InputUserChange change, InputDevice device)
        Debug.Log("onInputDeviceChange called, user = " + user + " change = " + change + " device = " + device);

    About the inspector events, the dynamic parameter is not indicated whether the event is empty or not. I tried dragging an object from the scene and from the assets folder, but that changed nothing. This only happened in my main project so far and only on the Controls Reader component.

  • Here is the event that can be received with ordinary Player Input components :

    What control scheme(s) have you configured in the Input Actions asset being read by an ordinary Player Input?

  • edited March 2023

    I just tried with both the DefaultInputActions and Controls Input Action Assets and left the control scheme to "any", and could receive the event with gamepad, keyboard and mouse inputs with the default asset, but only with gamepad and keyboard when using AC's.

  • edited March 2023

    only with gamepad and keyboard when using AC's.

    Sorry, but to clarify: with AC's Controls asset, it works with the default Player Input component, but not the provided Controls Reader?

    I am attempting a recreation, but if you can PM me a project that I can test with, it will help ensure the recreation is accurate.

  • That is correct : when I put AC's Controls asset into the simple Player Input component, I can get the event, but not when using AC's Controls Reader prefab. Is this issue on my end only ? Are you able to receive the event with the Controls Reader prefab ? In any case I'm going to send you the project in PM.

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.