Updated XRControllerInputRemapper. The changes made to XRControllerIn…#49
Open
thefirstfloor wants to merge 3 commits into
Conversation
…putRemapperNew.cs are fully compatible with versions of the Unity Input System package prior to 1.19.0 (including versions as old as 1.0.0).
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the XR controller input remapping MonoBehaviour to align with newer Unity Input System behavior by moving subscription management into the component lifecycle and adding guards to avoid null/index exceptions.
Changes:
- Renamed the remapper MonoBehaviour type and adjusted component lifecycle methods to subscribe/unsubscribe in
OnEnable/OnDisable. - Added validation to avoid
FindIndex/null-reference exceptions when enabling/disabling remaps. - Introduced a runtime
isSubscribedflag to prevent duplicate event subscriptions.
Comments suppressed due to low confidence (1)
Assets/com.edia.core/Runtime/Base/Scripts/XR/XRControllerInputRemapper.cs:69
Subscribe/UnsubscribeassumesmethodToCallis non-null (r.methodToCall.Invoke). IfControllerInputRemapentries are ever created programmatically (not via Unity serialization),methodToCallwill be null and this will throw at subscription time. Consider initializingmethodToCall(e.g., to a new UnityEvent) and/or adding a null check before subscribing/unsubscribing.
private void Subscribe(ControllerInputRemap r) {
if (r.isSubscribed || r.inputActionSubmit == null || r.inputActionSubmit.action == null) return;
r.inputActionSubmit.action.Enable();
r.inputActionSubmit.action.performed += r.methodToCall.Invoke;
r.isSubscribed = true;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adding a gate to check if component is active and enabled on subscribe call Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
eioe
reviewed
May 19, 2026
…putRemapperNew.cs are fully compatible with versions of the Unity Input System package prior to 1.19.0 (including versions as old as 1.0.0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems that unity updated some things in their input system.
Some changes were needed in the remapper script, also some validations are added to avoid exceptions and leftovers.
A.i claims:
…putRemapperNew.cs are fully compatible with versions of the Unity Input System package prior to 1.19.0 (including versions as old as 1.0.0).