-
Notifications
You must be signed in to change notification settings - Fork 330
NEW: Insights analytics support for the Input System #2272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c93bcdb
d0b8bb6
5c50794
31832b7
1dbbc48
e7794d2
32d53c5
d36d8fd
f42157a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2531,6 +2531,8 @@ private void OnNativeDeviceDiscovered(int deviceId, string deviceDescriptor) | |
| // Parse description, if need be. | ||
| var description = device?.description ?? InputDeviceDescription.FromJson(deviceDescriptor); | ||
|
|
||
| m_Runtime.LogDeviceConnectedInsight(description); | ||
|
|
||
| // Add it. | ||
| var markAsRemoved = false; | ||
| try | ||
|
|
@@ -3597,6 +3599,8 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev | |
| { | ||
| RemoveDevice(device, keepOnListOfAvailableDevices: false); | ||
|
|
||
| m_Runtime.LogDeviceDisconnectedInsight(device.description); | ||
|
|
||
|
Comment on lines
+3602
to
+3603
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar: should this be #if UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS? |
||
| // If it's a native device with a description, put it on the list of disconnected | ||
| // devices. | ||
| if (device.native && !device.description.empty) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| using UnityEngine.Analytics; | ||
| using UnityEngine.InputSystem.Utilities; | ||
| using UnityEngineInternal.Input; | ||
| using UnityEngine.InputSystem.Layouts; | ||
|
|
||
|
|
||
| #if UNITY_EDITOR | ||
| using System.Reflection; | ||
|
|
@@ -423,6 +425,27 @@ public void SendAnalytic(InputAnalytics.IInputAnalytic analytic) | |
| #endif //ENABLE_CLOUD_SERVICES_ANALYTICS | ||
| } | ||
|
|
||
| #endif // UNITY_ANALYTICS || UNITY_EDITOR | ||
| public void LogDeviceConnectedInsight(InputDeviceDescription description) | ||
| { | ||
| #if UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS && !UNITY_EDITOR | ||
| NativeInputSystem.LogDeviceConnectedInsight(description.serial, description.product, description.interfaceName, description.version); | ||
| #endif | ||
| } | ||
|
|
||
| public void LogDeviceDisconnectedInsight(InputDeviceDescription description) | ||
| { | ||
| #if UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS && !UNITY_EDITOR | ||
| NativeInputSystem.LogDeviceDisconnectedInsight(description.serial); | ||
| #endif | ||
| } | ||
|
|
||
| public void LogInputActionInsight(InputAction action) | ||
| { | ||
| #if UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS && !UNITY_EDITOR | ||
| NativeInputSystem.LogInputActionInsight(action.name, action.type.ToString()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not too familiar with input actions, I'm worried that enabling this will add a string allocation to every input action, resulting in two potential issues: performance degradation of all inputs (allocation perf) and frequent / large garbage collection (after many disparate allocations). Can this be cached? Do we have the action type string already stored somewhere? Is there another reason that invalidates the concern? |
||
| #endif | ||
| } | ||
|
|
||
| #endif // UNITY_ANALYTICS || UNITY_EDITOR | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,11 +92,16 @@ | |
| "expression": "6000.3.0a6", | ||
| "define": "UNITY_INPUT_SYSTEM_PLATFORM_POLLING_FREQUENCY" | ||
| }, | ||
| { | ||
| "name": "Unity", | ||
| { | ||
| "name": "Unity", | ||
| "expression": "6000.4.0a4", | ||
| "define": "UNITY_INPUTSYSTEM_SUPPORTS_MOUSE_SCRIPT_EVENTS" | ||
| } | ||
| }, | ||
| { | ||
| "name": "Unity", | ||
| "expression": "6000.5.0a5", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will have to be changed to whatever is the actual Unity version we happen to release Input insights in. We will know that once the native PR lands. Then we will change this for every backport |
||
| "define": "UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS" | ||
| } | ||
| ], | ||
| "noEngineReferences": false | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -481,6 +481,19 @@ public void SendAnalytic(InputAnalytics.IInputAnalytic analytic) | |
| #endif // UNITY_2023_2_OR_NEWER | ||
| } | ||
|
|
||
| #endif // UNITY_ANALYTICS || UNITY_EDITOR | ||
| // We don't want to populate Insights from within tests, even when running them in players | ||
| public void LogDeviceConnectedInsight(InputDeviceDescription description) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might want to store these in harness in case you want to test it in the package |
||
| { | ||
| } | ||
|
|
||
| public void LogDeviceDisconnectedInsight(InputDeviceDescription description) | ||
| { | ||
| } | ||
|
|
||
| public void LogInputActionInsight(InputAction action) | ||
| { | ||
| } | ||
|
|
||
| #endif // UNITY_ANALYTICS || UNITY_EDITOR | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that logging the input action is bracketed by the new define
UNITY_INPUT_SYSTEM_SUPPORTS_INSIGHTS. Should this also be conditional on it?