Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to use InputRecorder without focus (or in batchmode)

Discussion in 'Input System' started by nehvaleem, Aug 23, 2022.

  1. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    399
    Hi,
    am I doing something wrong or the InputRecorder isn't able to playback recorded input when the window doesn't have a focus?
    I want to record input and then play it back in batchmode when my playmode tests are being run. Based on the results of the tests (the ones with the input recorder are failing) and the fact that it seems unable to playback in a regular editor when the gameview isn't focused, I am guessing that there is something related to that.

    Am I correct? If so - is there anything that could help me run input playback in batchmode?
     
  2. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    399
    After a fair amount of digging through the forums and documentation, I've found
    BackgroundBehavior
    and
    PlayModeInputBehavior
    settings. I've tried to set those up to Ignore and AllDeviceInputAlwaysGoesToGameView respectively.

    Sadly that doesn't make any difference in my case. Events (in the UI & game objects with EventTrigger components) aren't being recognized properly unless I at least hover over my game view.

    Well, to be clear - it does make a difference when I am replaying the input manually from the inspector. But my case is related to automated tests that are running with the Unity Test Framework. If run them from there - there is no input processed inside the game.

    I've tried also many combinations of settings inside InputSystemUiInputModule. No results whatsoever.

    Is there anything that I can try?

    EDIT:
    My complete use-case is like this:
    1. I am entering the playmode and playing the level with recording the user input.
    2. I am saving the inputtrace to the file and quitting the playmode
    3. Then I am running the UnityTest that will load the same scene, feed the inputtrace to the recorder, and play it back.

    It is not working for me at the moment. I am seeing that some parts of the game that highlights something works just fine (getting the mouse pointer position on update), but no clicks are being recognized on InputTrigger and UI unless I click in the gameview to focus it.

    @Rene-Damm - could you please take a look?
     
    Last edited: Aug 31, 2022
    bratorange and Polyversian like this.
  3. bratorange

    bratorange

    Joined:
    Aug 30, 2023
    Posts:
    1
    Hey have you found anything since? Im having the exact same use case!
     
  4. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    399
    unfortunately not. I abandoned this idea.