Skip to content

Conversation

K-Tone
Copy link
Collaborator

@K-Tone K-Tone commented Sep 9, 2025

Description

This fixes up the current set of warnings that we get when using the package with Unity 6.4.

  • instanceID is now entityID
  • A new XRModule has to be used instead of the old one (to be addressed still)

Related to https://jira.unity3d.com/browse/ISX-2349

Testing status & QA

Local testing

Overall Product Risks

  • Complexity: Low
  • Halo Effect: Low

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.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • 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.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@K-Tone K-Tone changed the title fixup warnings with Unity 6.4 relating to the instanceId -> entityId … FIX: Address warnings that happened with Unity 6.4 Sep 9, 2025
@codecov-github-com
Copy link

codecov-github-com bot commented Sep 9, 2025

Codecov Report

Attention: Patch coverage is 24.00000% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...stem/Editor/AssetEditor/InputActionEditorWindow.cs 0.00% 10 Missing ⚠️
...Editor/UITKAssetEditor/InputActionsEditorWindow.cs 0.00% 9 Missing ⚠️
@@             Coverage Diff             @@
##           develop    #2233      +/-   ##
===========================================
- Coverage    68.17%   68.15%   -0.02%     
===========================================
  Files          367      367              
  Lines        53668    53685      +17     
===========================================
+ Hits         36587    36591       +4     
- Misses       17081    17094      +13     
Flag Coverage Δ
linux_2021.3_pkg 5.47% <0.00%> (-0.01%) ⬇️
linux_2021.3_project 70.40% <50.00%> (+<0.01%) ⬆️
linux_2022.3_pkg 5.24% <0.00%> (-0.01%) ⬇️
linux_2022.3_project 65.25% <31.25%> (-0.02%) ⬇️
linux_6000.0_pkg 5.25% <0.00%> (-0.01%) ⬇️
linux_6000.0_project 68.06% <31.25%> (+<0.01%) ⬆️
linux_6000.2_pkg 5.25% <0.00%> (-0.01%) ⬇️
linux_6000.2_project 68.06% <31.25%> (+<0.01%) ⬆️
linux_trunk_pkg 5.25% <0.00%> (-0.01%) ⬇️
linux_trunk_project 68.05% <31.25%> (-0.01%) ⬇️
mac_2021.3_pkg 5.46% <0.00%> (-0.01%) ⬇️
mac_2021.3_project 70.41% <50.00%> (+<0.01%) ⬆️
mac_2022.3_pkg 5.24% <0.00%> (-0.01%) ⬇️
mac_2022.3_project 65.27% <31.25%> (-0.01%) ⬇️
mac_6000.0_pkg 5.24% <0.00%> (-0.01%) ⬇️
mac_6000.0_project 68.09% <31.25%> (+<0.01%) ⬆️
mac_6000.2_pkg 5.24% <0.00%> (-0.01%) ⬇️
mac_6000.2_project 68.07% <31.25%> (-0.01%) ⬇️
mac_trunk_pkg 5.24% <0.00%> (-0.01%) ⬇️
mac_trunk_project 68.07% <31.25%> (-0.02%) ⬇️
win_2021.3_pkg 5.47% <0.00%> (-0.01%) ⬇️
win_2021.3_project 70.49% <50.00%> (+<0.01%) ⬆️
win_2022.3_pkg 5.24% <0.00%> (-0.01%) ⬇️
win_2022.3_project 65.35% <31.25%> (-0.01%) ⬇️
win_6000.0_pkg 5.25% <0.00%> (-0.01%) ⬇️
win_6000.0_project 68.15% <31.25%> (-0.01%) ⬇️
win_6000.2_pkg 5.25% <0.00%> (-0.01%) ⬇️
win_6000.2_project 68.15% <31.25%> (-0.01%) ⬇️
win_trunk_pkg 5.25% <0.00%> (-0.01%) ⬇️
win_trunk_project 68.15% <31.25%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/com.unity.inputsystem/InputSystem/InputSystem.cs 83.05% <100.00%> (+0.08%) ⬆️
...system/InputSystem/Plugins/XR/TrackedPoseDriver.cs 85.37% <ø> (ø)
...y.inputsystem/InputSystem/Utilities/MiscHelpers.cs 83.33% <ø> (ø)
...Editor/UITKAssetEditor/InputActionsEditorWindow.cs 49.31% <0.00%> (-1.21%) ⬇️
...stem/Editor/AssetEditor/InputActionEditorWindow.cs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@K-Tone K-Tone force-pushed the anthony/isx-2349-unity-6.4-warnings branch from d57e958 to 24bda46 Compare September 10, 2025 07:24
@K-Tone K-Tone marked this pull request as ready for review September 10, 2025 07:24
@K-Tone K-Tone requested a review from ekcoh September 10, 2025 07:24
// See https://jira.unity3d.com/browse/XR-7591
#pragma warning disable CS0618
UnityEngine.XR.XRDevice.DisableAutoXRCameraTracking(cameraComponent, true);
#pragma warning restore CS0618
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#if UNITY_6000_4_OR_NEWER
public static bool OpenAsset(EntityId entityId, int line)
{
if (!InputActionImporter.IsInputActionAssetPath(AssetDatabase.GetAssetPath(entityId)))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now that I read this code myself, I could have left IsInputActionAssetPath in OpenAsset, just the GetAssetPath thing is different. IDK, either way goes fine by my books

Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: But I would agree with you, that if it makes the "fork condition" slimmer it is a good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But its also fine as-is

@K-Tone K-Tone requested a review from Copilot September 10, 2025 08:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses compilation warnings that occur when using the Input System package with Unity 6.4 by updating deprecated APIs and maintaining backward compatibility with earlier Unity versions.

  • Updates the deprecated instanceID API to use the new entityID API introduced in Unity 6.4
  • Adds pragma warnings to suppress deprecation warnings for XR device APIs that don't have replacements yet
  • Implements conditional compilation to maintain compatibility across Unity versions

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MiscHelpers.cs Adds UnityEditor using statement for editor functionality
TrackedPoseDriver.cs Adds pragma warnings around deprecated XR API calls with explanatory comments
InputSystem.cs Implements HasNativeObject helper method with conditional compilation for instanceID/entityID migration
InputActionsEditorWindow.cs Updates OnOpenAsset method to handle both instanceID and entityID based on Unity version
InputActionEditorWindow.cs Updates OnOpenAsset method to handle both instanceID and entityID based on Unity version
CHANGELOG.md Documents the fix for Unity 6.4 compilation warnings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

K-Tone and others added 2 commits September 10, 2025 11:04
…rs.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@K-Tone
Copy link
Collaborator Author

K-Tone commented Sep 10, 2025

Good catches on this PR by Copilot

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

I think this looks good. Just some thoughts and minor comments that if they work could reduce the diffs and forks-conditionals.

#if UNITY_6000_4_OR_NEWER
public static bool OpenAsset(EntityId entityId, int line)
{
if (!InputActionImporter.IsInputActionAssetPath(AssetDatabase.GetAssetPath(entityId)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: But I would agree with you, that if it makes the "fork condition" slimmer it is a good idea.

#if UNITY_6000_4_OR_NEWER
public static bool OpenAsset(EntityId entityId, int line)
{
if (!InputActionImporter.IsInputActionAssetPath(AssetDatabase.GetAssetPath(entityId)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

But its also fine as-is

}

// We have this function to hide away instanceId -> entityId migration that happened in Unity 6.4
public static bool HasNativeObject(Object obj)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: Hmmm.... This diff was hard to review but just a thought.

What if this code was changed so that HasNativeObject(Object) would call another function:

Object GetObjectFromEntityID(EntityId id) { <same #if dance to map to EditorUtility> }

And then using a conditional alias where needed for EntityId, e.g.

#if !UNITY_6000_4_OR_NEWER
using EntityId = int;
#endif

Would that eliminate all other branches?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it just makes things weird if entity id and instance id are fundamentally different, if not maybe its something....

@K-Tone K-Tone merged commit d1d72d5 into develop Sep 11, 2025
114 checks passed
@K-Tone K-Tone deleted the anthony/isx-2349-unity-6.4-warnings branch September 11, 2025 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants