docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TryInitializeWithDevices

    TryInitializeWithDevices(IEnumerable<InputDevice>, IEnumerable<InputDevice>)

    Find the best control scheme for the available devices and initialize the action map input.

    It's important to note that an action map that can use either of two devices should have two of the same device listed in the control scheme. Otherwise, if the ActionMapInput is initialized with those two devices, the first device state found will override the other's device state. This becomes apparent when GetDeviceStateForDeviceSlot is called.

    Ex. Having a left and right VR controller where the action map can accept either controller's trigger button would cause issues if only one device was listed in the action map. Usually, this shows up as a ping-ponging issue where the ActionMapInput keeps getting re-initialized and binds different devices.

    Declaration
    public bool TryInitializeWithDevices(IEnumerable<InputDevice> availableDevices, IEnumerable<InputDevice> requiredDevices = null)
    Parameters
    Type Name Description
    IEnumerable<InputDevice> availableDevices

    Available devices in the system

    IEnumerable<InputDevice> requiredDevices
    Returns
    Type Description
    bool
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)