Skip to content
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

Input Action Editor Session Analytics Support + Refactor (ISX-1546) #1808

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from

Conversation

ekcoh
Copy link
Collaborator

@ekcoh ekcoh commented Dec 18, 2023

Description

This PR introduces Unity Editor analytics support for getting insight into Input Action editor engagement and usage. Analytics have been designed to enable differentiation between an editor embedded into Project Settings (Project-wide actions) as well as a free-floating asset based editor, but otherwise be comparable. The analytics currently only track engagement on a high-level without being specific about specific user actions. Defined metrics are tracked via associated DASD ticket, see ISX-1546 for reference.

Changes made

  • Added new struct InputActionsEditorSessionData which contains the raw analytic metric fields and documentation.
  • Added new class InputAnalytics.InputActionsEditorSessionAnalytic acting as a proxy object around InputActionsEditorSessionData to provide abstraction around counting operations to prevent direct access and possible related mistakes in code providing metrics.
  • Modified new analytics code to conditionally utilise UnityEngine.Analytics.IAnalytic.IData when compiled on Unity 2023.2 or later and otherwise use legacy setup for analytics. This is achieved by conditionally defining the new IInputAnalytic to either derive from the new IAnalytic or to define a similar interface. This simplifies test and usage code.
  • Refactored existing analytics collection code and reduced number of allocations by using arrays directly instead of lists.
  • Refactored existing analytics constants into C# constants.
  • Refactored analytics tests based on above changed.
  • Refactored IInputRuntime interface and derived classes NativeInputRuntime and InputTestRuntime.
  • Potentially fixed a bug in NativeInputRuntime since previously did not send analytics unless UNITY_ANALYTICS was defined, but this do not seem to be defined in editor anyway. Any insight into this from reviewers would be useful.
  • Modified existing analytics code (Not introduced in this PR) to conditionally utilise UnityEngine.Analytics.IAnalytic.IData when compiled on Unity 2023.2 or later and otherwise use legacy setup for analytics.
  • Added test cases to cover new editor session analytics.
  • Added hooks to UTIK editor to measure action map, action, binding and control scheme edits in addition to explicit and implicit saves as well as reset.

Notes

Development guidelines for how to integrate editor analytics and test them are linked form the internal ISX ticket.
This PR do not introduce analytics for legacy IMGUI editor. If this is needed additional work is needed to setup corresponding hooks for that editor.

This PR can be reviewed and tested as is but should likely not be merged until verified with help of backend engineers so it doesn't introduce regressions for existing analytics and to verify that new analytics are correct.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • FogBugz ticket attached, example ([case %number%](https://issuetracker.unity3d.com/issues/...)).
    • FogBugz is marked as "Resolved" with next release version correctly set.
  • Tests added/changed, if applicable.
    • Functional tests added to CoreTests_Analytics.cs
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

# Conflicts:
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs
# Conflicts:
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindowUtils.cs
@ekcoh ekcoh added the work in progress Indicates that the PR is work in progress and any review efforts can be post-poned. label Dec 18, 2023
@ekcoh ekcoh changed the title Input Action Editor Session Analytics Support (ISX-1546) WIP: Input Action Editor Session Analytics Support (ISX-1546) Dec 18, 2023
@ekcoh ekcoh changed the title WIP: Input Action Editor Session Analytics Support (ISX-1546) Input Action Editor Session Analytics Support (ISX-1546) Dec 21, 2023
@ekcoh
Copy link
Collaborator Author

ekcoh commented Dec 21, 2023

One problem with this PR/branch is that I noticed formatter fails on InputAnalytics.cs with issue relating to matching an opening bracket early in the file. Not sure why this is, if someone spots the error that I fail to find it would be very helpful.

@ekcoh ekcoh removed the work in progress Indicates that the PR is work in progress and any review efforts can be post-poned. label Dec 21, 2023
@ekcoh ekcoh changed the title Input Action Editor Session Analytics Support (ISX-1546) Input Action Editor Session Analytics Support + Refactor (ISX-1546) Dec 21, 2023
Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failures in CI need to be looked at and this also introduces errors when adding new maps and actions in the custom action asset window.

For example:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.Commands+<>c.<AddActionMap>b__2_0 (UnityEngine.InputSystem.Editor.InputActionsEditorState& state) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs:33)
UnityEngine.InputSystem.Editor.StateContainer.Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs:35)
UnityEngine.InputSystem.Editor.ViewBase`1[TViewState].Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs:70)
UnityEngine.InputSystem.Editor.ActionMapsView.AddActionMap () (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs:113)
UnityEngine.UIElements.Clickable.Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Clickable.cs:245)
UnityEngine.UIElements.Clickable.ProcessUpEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.Vector2 localPosition, System.Int32 pointerId) (at D:/Gitrepo/unity/Modules/UIElements/Core/Clickable.cs:342)
UnityEngine.UIElements.Clickable.OnPointerUp (UnityEngine.UIElements.PointerUpEvent evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Clickable.cs:209)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallbackRegistry.cs:228)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:310)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:578)
UnityEngine.UIElements.PointerEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/PointerEvents.cs:1180)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:200)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/Panel.cs:625)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:506)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:225)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:206)

@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 8, 2024

Thanks @Pauliusd01 I'll check and follow-up with additional changes

Copy link
Collaborator

@lyndon-unity lyndon-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable update. A couple of minor questions.

Assets/Tests/InputSystem/CoreTests_Analytics.cs Outdated Show resolved Hide resolved
@ekcoh ekcoh removed the request for review from jamesmcgill January 10, 2024 09:55
@Pauliusd01
Copy link
Collaborator

Pauliusd01 commented Jan 10, 2024

Adding new actions in the input actions window still throws this error (not sure if I was supposed to check yet, checked on #660a74d. Ignore me if I'm checking too early):

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.Commands+<>c.<AddAction>b__3_0 (UnityEngine.InputSystem.Editor.InputActionsEditorState& state) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs:51)
UnityEngine.InputSystem.Editor.StateContainer.Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs:35)
UnityEngine.InputSystem.Editor.ViewBase`1[TViewState].Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs:70)
UnityEngine.InputSystem.Editor.ActionsTreeView.AddAction () (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs:217)
UnityEngine.InputSystem.Editor.InputActionViewsControlsHolder.CreateNewActionMap (UnityEngine.InputSystem.Editor.InputActionMapsTreeViewItem item) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionViewsControlsHolder.cs:61)
UnityEngine.InputSystem.Editor.ContextMenu+<>c__DisplayClass5_0.<GetContextMenuForActionMapItem>b__1 (UnityEngine.UIElements.DropdownMenuAction _) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs:25)
UnityEngine.UIElements.DropdownMenuAction.Execute () (at D:/Gitrepo/unity/Modules/UIElements/Core/DropdownMenu.cs:295)
UnityEditor.UIElements.EditorMenuExtensions+<>c__DisplayClass22_0.<PrepareMenu>b__0 () (at D:/Gitrepo/unity/Editor/Mono/UIElements/EditorMenuExtensions.cs:307)
UnityEngine.UIElements.GenericDropdownMenu+MenuItem.PerformAction () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:45)
UnityEngine.UIElements.GenericDropdownMenu.ClickItem () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:567)
UnityEngine.UIElements.GenericDropdownMenu.OnPointerUp (UnityEngine.UIElements.PointerUpEvent evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:619)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallbackRegistry.cs:228)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:310)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCachedElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:538)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:581)
UnityEngine.UIElements.PointerEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/PointerEvents.cs:1180)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:200)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/Panel.cs:625)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:506)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:225)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:206)

@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 10, 2024

One problem with this PR/branch is that I noticed formatter fails on InputAnalytics.cs with issue relating to matching an opening bracket early in the file. Not sure why this is, if someone spots the error that I fail to find it would be very helpful.

This have now been addressed/fixed.

@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 11, 2024

Adding new actions in the input actions window still throws this error (not sure if I was supposed to check yet, checked on #660a74d. Ignore me if I'm checking too early):

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.Commands+<>c.<AddAction>b__3_0 (UnityEngine.InputSystem.Editor.InputActionsEditorState& state) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs:51)
UnityEngine.InputSystem.Editor.StateContainer.Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs:35)
UnityEngine.InputSystem.Editor.ViewBase`1[TViewState].Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs:70)
UnityEngine.InputSystem.Editor.ActionsTreeView.AddAction () (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs:217)
UnityEngine.InputSystem.Editor.InputActionViewsControlsHolder.CreateNewActionMap (UnityEngine.InputSystem.Editor.InputActionMapsTreeViewItem item) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionViewsControlsHolder.cs:61)
UnityEngine.InputSystem.Editor.ContextMenu+<>c__DisplayClass5_0.<GetContextMenuForActionMapItem>b__1 (UnityEngine.UIElements.DropdownMenuAction _) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs:25)
UnityEngine.UIElements.DropdownMenuAction.Execute () (at D:/Gitrepo/unity/Modules/UIElements/Core/DropdownMenu.cs:295)
UnityEditor.UIElements.EditorMenuExtensions+<>c__DisplayClass22_0.<PrepareMenu>b__0 () (at D:/Gitrepo/unity/Editor/Mono/UIElements/EditorMenuExtensions.cs:307)
UnityEngine.UIElements.GenericDropdownMenu+MenuItem.PerformAction () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:45)
UnityEngine.UIElements.GenericDropdownMenu.ClickItem () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:567)
UnityEngine.UIElements.GenericDropdownMenu.OnPointerUp (UnityEngine.UIElements.PointerUpEvent evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:619)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallbackRegistry.cs:228)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:310)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCachedElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:538)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:581)
UnityEngine.UIElements.PointerEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/PointerEvents.cs:1180)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:200)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/Panel.cs:625)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:506)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:225)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:206)

You are absolutely right it seems, this used to work, so guess I have accidentally reverted it at some point. Will fix and ping you back.

@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 11, 2024

Adding new actions in the input actions window still throws this error (not sure if I was supposed to check yet, checked on #660a74d. Ignore me if I'm checking too early):

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.Commands+<>c.<AddAction>b__3_0 (UnityEngine.InputSystem.Editor.InputActionsEditorState& state) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs:51)
UnityEngine.InputSystem.Editor.StateContainer.Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs:35)
UnityEngine.InputSystem.Editor.ViewBase`1[TViewState].Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs:70)
UnityEngine.InputSystem.Editor.ActionsTreeView.AddAction () (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs:217)
UnityEngine.InputSystem.Editor.InputActionViewsControlsHolder.CreateNewActionMap (UnityEngine.InputSystem.Editor.InputActionMapsTreeViewItem item) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionViewsControlsHolder.cs:61)
UnityEngine.InputSystem.Editor.ContextMenu+<>c__DisplayClass5_0.<GetContextMenuForActionMapItem>b__1 (UnityEngine.UIElements.DropdownMenuAction _) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs:25)
UnityEngine.UIElements.DropdownMenuAction.Execute () (at D:/Gitrepo/unity/Modules/UIElements/Core/DropdownMenu.cs:295)
UnityEditor.UIElements.EditorMenuExtensions+<>c__DisplayClass22_0.<PrepareMenu>b__0 () (at D:/Gitrepo/unity/Editor/Mono/UIElements/EditorMenuExtensions.cs:307)
UnityEngine.UIElements.GenericDropdownMenu+MenuItem.PerformAction () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:45)
UnityEngine.UIElements.GenericDropdownMenu.ClickItem () (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:567)
UnityEngine.UIElements.GenericDropdownMenu.OnPointerUp (UnityEngine.UIElements.PointerUpEvent evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Controls/GenericDropdownMenu.cs:619)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallbackRegistry.cs:228)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:310)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCachedElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:538)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:581)
UnityEngine.UIElements.PointerEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/PointerEvents.cs:1180)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:200)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/Panel.cs:625)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:506)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:225)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:206)

This should now be fixed

Copy link
Collaborator

@ritamerkl ritamerkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, good to know we will be able to see some statistics for the UITK editor soon!
I will have to look deeper into this - just a few comments to start with.

public enum Kind
{
Invalid = 0,
FreeFloatingEditorWindow = 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that describe the editor that is opened from a custom created asset? It sounds a bit like this is a window that is not attached to any area in the editor but rather lays in another new window.

@@ -112,6 +118,7 @@ private static InputActionsEditorWindow GetOrCreateWindow(int id, out bool isAlr
isAlreadyOpened = false;
if (HasOpenInstances<InputActionsEditorWindow>())
{
// TODO Would need to reset analytics here?!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO comment

@Pauliusd01 Pauliusd01 self-requested a review January 15, 2024 11:28
@Pauliusd01
Copy link
Collaborator

Pauliusd01 commented Jan 25, 2024

NullReferenceException thrown when adding actions/maps to ProjectWideActions and immediately closing the window:
https://github.com/Unity-Technologies/InputSystem/assets/54306142/01e26515-d1f9-482f-89ed-451799962011

…e to incorrect function calls to Activate and Deactivate. Hence adding a null check to work around that problem.
@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 29, 2024

NullReferenceException thrown when adding actions/maps to ProjectWideActions and immediately closing the window:
https://github.com/Unity-Technologies/InputSystem/assets/54306142/01e26515-d1f9-482f-89ed-451799962011

Thanks for finding this. Its due to a bug in Unity SettingsProvider calls exposing a null-reference situation that should never happen. I have added a null check to avoid it so should be "fixed" now.

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Mainly only tested for any broken functionality in custom input action assets, projectwideactions, few sample scenes

@ekcoh ekcoh added the work in progress Indicates that the PR is work in progress and any review efforts can be post-poned. label Jan 30, 2024
@ekcoh
Copy link
Collaborator Author

ekcoh commented Jan 30, 2024

LGTM. Mainly only tested for any broken functionality in custom input action assets, projectwideactions, few sample scenes

Good to hear. Pulling this back into work-in-progress since I am adding additional analytics into the mix after recent decisions to also track workflows.

# Conflicts:
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs
#	Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress Indicates that the PR is work in progress and any review efforts can be post-poned.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants