docs.unity3d.com
    Show / Hide Table of Contents

    Alternative Input Systems

    Some Cinemachine components (e.g. FreeLook, POV, OrbitalTransposer) require user input to position or orient the camera. By default, Cinemachine gets user input by querying the standard Unity Input.GetAxis(name).

    When alternative input systems are used in a project, this default behaviour must be overridden so that input is obtained from the appropriate source.

    Cinemachine has defined an interface: Cinemachine.AxisState.IInputAxisProvider. If a MonoBehaviour implementing this interface is added to a Virtual Camera or FreeLook, then it will be queried for input instead of the standard input system.

    Cinemachine ships with an example of such a behaviour that uses the new UnityEngine.Input package: CinemachineInputProvider. It has dual purpose:

    1. Provide a simple out-of-the-box adapter for the new UnityEngine.Input package, to cover common usecases
    2. To serve as a source code example of how to integrate Cinemachine with custom or 3rd-party input systems

    CinemachineInputProvider

    CinemachineInputProvider inspector.

    This is a behaviour that is intended to be added to a virtual camera or FreeLook. It is an input source override, which causes the virtual camera to obtain input using the new UnityEngine.Input package instead of the standard Unity Input system.

    This behaviour is available when the UnityEngine.Input package is installed in the project.

    Properties:

    Property: Function:
    Player Index Which player's input controls to query. Leave this at the default value of -1 for single-player games. Otherwise this should be the index of the player in the UnityEngine.Inout.InputUser.all list
    XY Axis A Vector2 input action that will supply values for the X and Y axes. Can be null if X and Y axes are not used
    Z Axis A float input action that will supply values for the Z axis. Can be null if Z axis is not used
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023