From 3fac18e221fc47ddeb582588ba009851dce68710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Malrat?= Date: Mon, 19 Aug 2024 10:46:19 -0400 Subject: [PATCH 1/2] Fixed Package compilation when Unity Analytics module is not enabled on 2022.3. --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + .../com.unity.inputsystem/InputSystem/NativeInputRuntime.cs | 3 +++ .../InputSystem/Unity.InputSystem.asmdef | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index e31516ffc1..3cbc97ecf6 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -14,6 +14,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed memory allocation on every frame when using UIDocument without EventSystem. [ISXB-953](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-953) - Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI. - Fixed InputDeviceTester sample only visualizing a given touch contact once. [ISXB-1017](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1017) +- Fixed Package compilation when Unity Analytics module is not enabled on 2022.3. [ISXB-996](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-996) ### Added - Added Hinge Angle sensor support for foldable devices. diff --git a/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs b/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs index af5230a7d0..55026534dc 100644 --- a/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs +++ b/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs @@ -398,9 +398,12 @@ public void SendAnalytic(InputAnalytics.IInputAnalytic analytic) #if (UNITY_2023_2_OR_NEWER) EditorAnalytics.SendAnalytic(analytic); #else + // This is a workaround for the fact that the AnalyticsResult enum is not available before 2023.1.0a14 when not using the built-in Unity Analytics module. + #if UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS || UNITY_2023_1_OR_NEWER var info = analytic.info; EditorAnalytics.RegisterEventWithLimit(info.Name, info.MaxEventsPerHour, info.MaxNumberOfElements, InputAnalytics.kVendorKey); EditorAnalytics.SendEventWithLimit(info.Name, analytic); + #endif // UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS || UNITY_2023_1_OR_NEWER #endif // UNITY_2023_2_OR_NEWER #elif (UNITY_ANALYTICS) // Implicitly: !UNITY_EDITOR var info = analytic.info; diff --git a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef index 5c22fadc32..d35fc93cc1 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef +++ b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef @@ -91,6 +91,11 @@ "name": "Unity", "expression": "6000.0.11", "define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA" + }, + { + "name": "com.unity.modules.unityanalytics", + "expression": "1", + "define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS" } ], "noEngineReferences": false From c68d7a3052c7979945cd9423834315da5decc4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Malrat?= Date: Mon, 19 Aug 2024 12:41:59 -0400 Subject: [PATCH 2/2] format fix --- .../com.unity.inputsystem/InputSystem/NativeInputRuntime.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs b/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs index 55026534dc..f82d5fa8b3 100644 --- a/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs +++ b/Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs @@ -398,7 +398,7 @@ public void SendAnalytic(InputAnalytics.IInputAnalytic analytic) #if (UNITY_2023_2_OR_NEWER) EditorAnalytics.SendAnalytic(analytic); #else - // This is a workaround for the fact that the AnalyticsResult enum is not available before 2023.1.0a14 when not using the built-in Unity Analytics module. + // The preprocessor filtering is a workaround for the fact that the AnalyticsResult enum is not available before 2023.1.0a14 when not using the built-in Unity Analytics module. #if UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS || UNITY_2023_1_OR_NEWER var info = analytic.info; EditorAnalytics.RegisterEventWithLimit(info.Name, info.MaxEventsPerHour, info.MaxNumberOfElements, InputAnalytics.kVendorKey);