Skip to content

Conversation

ekcoh
Copy link
Collaborator

@ekcoh ekcoh commented Oct 7, 2025

Description

This PR addresses user reported issue: https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1637 in the following ways:

  • Adds a direct null pointer check to DeltaStateEvent.cs where pointer arithmetic would be incorrect and lead to exception or crash when offsetting a nullptr.
  • Adds an indirect null pointer check to InputTestFixture.cs (via new internal property InputControl.hasState) where accessing a device from "outside" test context would lead to the same symptoms as above. This is now instead checked and throws exception if this is attempted.
  • Adds new test class InputTestFixtureTests that verifies normal behavior in InputTestFixture as well as inappropriate use similar to the reported repro project.

The problem in the provided repro project is two-fold:

  • Using [OneTimeSetup] and [OneTimeTearDown] to manage test devices. This will not work as intended since the device will be added to the real Input System context, then removed as part of InputTestFixture.Setup(). To reduce chance of similar accidental situations, I have added information recommending against this to InputTestFixture xmldoc. In addition, if this is attempted it should result in exception which is verified in the added tests.
  • Using InputTestFixture in edit-mode tests [UnityTest] which isn't fully supported it seems.

Open issues:

  • Figure out why UnityTest doesn't work.

Testing status & QA

Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity:
  • Halo Effect:

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

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.

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.

1 participant