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
NEW: Added CursorLockBehavior to InputSystemUIInputModule to enable pointer events when the cursor is locked. #1518
Conversation
| EditorGUIUtility.TrTextContent("Cursor Lock Behavior", | ||
| $"Controls the origin point of UI raycasts when the cursor is locked. {InputSystemUIInputModule.CursorLockBehavior.OutsideScreen} " + | ||
| $"is the default behavior and will force the raycast to miss all objects. {InputSystemUIInputModule.CursorLockBehavior.ScreenCenter} " + | ||
| $"will cast the ray from the center of the screen.")); |
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.
Should probably update manual screenshot and doc.
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.
Agree, and include @duckets on the review after the change
Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs
Show resolved
Hide resolved
| EditorGUIUtility.TrTextContent("Cursor Lock Behavior", | ||
| $"Controls the origin point of UI raycasts when the cursor is locked. {InputSystemUIInputModule.CursorLockBehavior.OutsideScreen} " + | ||
| $"is the default behavior and will force the raycast to miss all objects. {InputSystemUIInputModule.CursorLockBehavior.ScreenCenter} " + | ||
| $"will cast the ray from the center of the screen.")); |
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.
Agree, and include @duckets on the review after the change
…ointer events when the cursor is locked.
* Updated documentation and images * Fixed compile error on newer versions of Unity due to UIElements
Fogbugz
Issue Tracker
Description
IPointerEnterHandler and IPointerExitHandler interfaces did not work when the cursor was locked. This made it impossible to use PhysicsRaycaster to interact with world space UI or objects using pointer-driven gaze direction. The issue occurs because when the cursor is locked, the raycast origin is placed outside the screen, which causes raycast logic to short-circuit and always miss all objects.
Changes made
Added the CursorLockBehaviour enum and a setting in InputSystemUIInputModule to allow the user to specify that when the cursor is locked, raycasts should originate from the center of the screen.
Checklist
Before review:
Changed,Fixed,Addedsections.([case %number%](https://issuetracker.unity3d.com/issues/...)).Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.