From 911d2dd002826c368f2649763f65ae7f031e6e81 Mon Sep 17 00:00:00 2001 From: lawwong Date: Fri, 22 Nov 2024 11:39:12 +0800 Subject: [PATCH 1/2] Add null check --- .../ViveInputUtility/Scripts/VIUSyntheticDevice.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUSyntheticDevice.cs b/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUSyntheticDevice.cs index 58b62f20..2cd1a876 100644 --- a/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUSyntheticDevice.cs +++ b/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUSyntheticDevice.cs @@ -209,14 +209,19 @@ public VIUSyntheticDevice GetDevice(int roleValue) private VIUSyntheticDevice AddDevice(ViveRole.IMap map, int roleValue) { - VIUSyntheticDevice device; try { - device = InputSystem.AddDevice(new InputDeviceDescription() + var device = InputSystem.AddDevice(new InputDeviceDescription() { interfaceName = layoutName, manufacturer = "HTC ViveSoftware", }) as VIUSyntheticDevice; + + if (device == null) + { + Debug.LogError("[VIUSyntheticDevice] InputSystem.AddDevice(InputDeviceDescription) failed!"); + return null; + } InputSystem.AddDeviceUsage(device, map.RoleValueInfo.GetNameByRoleValue(roleValue)); if (leftRgx.IsMatch(layoutName)) @@ -227,14 +232,15 @@ private VIUSyntheticDevice AddDevice(ViveRole.IMap map, int roleValue) { InputSystem.AddDeviceUsage(device, CommonUsages.RightHand); } + + device.ctrlState = ViveInput.GetState(map.RoleValueInfo.RoleEnumType, roleValue); + return device; } catch (Exception e) { Debug.LogException(e); return null; } - device.ctrlState = ViveInput.GetState(map.RoleValueInfo.RoleEnumType, roleValue); - return device; } private static void ResumeDevice(InputDevice device) From 28700d98c99bec35ad192057765a6bfadaabc78d Mon Sep 17 00:00:00 2001 From: lawwong Date: Mon, 2 Dec 2024 16:58:21 +0800 Subject: [PATCH 2/2] Update version code to v1.20.2 --- Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUVersion.cs | 2 +- Assets/HTC.UnityPlugin/package.json | 2 +- CHANGELOG.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUVersion.cs b/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUVersion.cs index 5ff155bd..28b10974 100644 --- a/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUVersion.cs +++ b/Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/VIUVersion.cs @@ -6,6 +6,6 @@ namespace HTC.UnityPlugin.Vive { public static class VIUVersion { - public static readonly Version current = new Version("1.20.1.0"); + public static readonly Version current = new Version("1.20.2.0"); } } \ No newline at end of file diff --git a/Assets/HTC.UnityPlugin/package.json b/Assets/HTC.UnityPlugin/package.json index ee886b5b..a7ad1144 100644 --- a/Assets/HTC.UnityPlugin/package.json +++ b/Assets/HTC.UnityPlugin/package.json @@ -1,6 +1,6 @@ { "name": "com.htc.upm.vive-input-utility", - "version": "1.20.1", + "version": "1.20.2", "displayName": "VIVE Input Utility", "description": "The VIVE Input Utility (VIU) is a toolkit for developing VR experiences in Unity, especially with the VIVE/VIVE Pro but also targeting many platforms from a common code base including Oculus Rift, Rift S Go, Quest, Google Daydream, VIVE Wave SDK (e.g. VIVE Focus standalone) and additional VR platforms as supported by Unity such as Microsoft's 'Mixed Reality' VR headsets and more.\n\nCompatible with SteamVR 2.4.0+ and Oculus Integration 16.0+.\n\nView license:\nhttps://github.com/ViveSoftware/ViveInputUtility-Unity/blob/develop/LICENSE.md", "keywords": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e5f2447..54c9325a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ -# Vive Input Utility for Unity - v1.20.1 +# Vive Input Utility for Unity - v1.20.2 Copyright (c) 2016-2024, HTC Corporation. All rights reserved. -## Changes for v1.20.1: +## Changes for v1.20.2: * Changes - Add support for Unity 6