/// <summary/> protected override void Start() { base.Start(); if (_mainCanvas == null) { Debug.LogError("Error: MLInputModule, _mainCanvas field is empty, disabling script."); enabled = false; return; } _mainCamera = Camera.main; if (_mainCamera == null) { Debug.LogError("Error: MLInputModule, no camera found tagged as MainCamera, disabling script."); enabled = false; return; } _mainCanvas.worldCamera = _mainCamera; SceneManager.activeSceneChanged += ChangedActiveScene; #if PLATFORM_LUMIN // Controllers if (!MLInput.IsStarted) { MLInput.Configuration config = new MLInput.Configuration(true); MLInput.SetConfig(config); } #endif AddController(0); AddController(1); #if PLATFORM_LUMIN // Track connect / disconnect MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; _pointerInputDevice = new MLInputDevice(); _pointerInputDevice.Initialize(); _cachedTrackedPointerEventData = new MLInputDeviceEventData(eventSystem); #endif }
/// <summary> /// Starts the MLInput, initializes the first controller, and registers the connection handlers /// </summary> void Start() { if (_devicesAllowed == 0) { Debug.LogErrorFormat("Error: ControllerConnectionHandler._devicesAllowed is invalid, disabling script."); enabled = false; return; } bool requestCFUID = DevicesAllowed.HasFlag(DeviceTypesAllowed.ControllerLeft) || DevicesAllowed.HasFlag(DeviceTypesAllowed.ControllerRight); #if PLATFORM_LUMIN MLInput.Configuration config = new MLInput.Configuration(requestCFUID, MLInput.Configuration.DefaultTriggerDownThreshold, MLInput.Configuration.DefaultTriggerUpThreshold); MLInput.SetConfig(config); MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; #endif GetAllowedInput(); }
public static MLResult Start(MLInput.Configuration config) { MLInput.SetConfig(config); return(MLResult.Create(MLResult.Code.Ok)); }