Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Any good way to fake inputs without using the test framework

Discussion in 'Input System' started by Baste, Sep 11, 2020.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,342
    I've got a character controller that I need to fine-tune. In order to do that, I want to play the game frame-by-frame, while setting which input is active.

    I pretty much want to write the code from the first example here:
    https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Testing.html
    , but that requires importing the test fixture assembly. That seems like overkill, plus we're working with our main codebase in Assembly-CSharp because having assemblies for the main codebase turned out to be bad and horrid and not something we want to do ever again if we can avoid it.


    Right now it seems like the most convenient thing is to copy-paste a bunch of stuff from InputTestFixture and use it, but that also seems hard!

    All I want is to be able to manually make an InputAction.CallbackContext that returns 'true' for context.started and 'right' for ReadValue<Vector2>(), so I can pass it to my OnMove, but both of those are read-only properties that seems to be kinda gnarly to replicate, so idk.

    Any advice`?