Skip to content

Commit f565754

Browse files
Merge pull request #450 from Unity-Technologies/bugfixes/schoen/player-head-ui
Fix a bug where the player head was blocking UI raycasts
2 parents cb49d03 + f3fb99c commit f565754

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Scripts/Core/EditorVR.Rays.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ partial class EditorVR
1818
[SerializeField]
1919
ProxyExtras m_ProxyExtras;
2020

21-
class Rays : Nested, IInterfaceConnector, IForEachRayOrigin, IConnectInterfaces
21+
class Rays : Nested, IInterfaceConnector, IForEachRayOrigin, IConnectInterfaces, IStandardIgnoreList
2222
{
2323
internal delegate void ForEachProxyDeviceCallback(DeviceData deviceData);
2424

@@ -35,6 +35,8 @@ class Rays : Nested, IInterfaceConnector, IForEachRayOrigin, IConnectInterfaces
3535

3636
internal Transform lastSelectionRayOrigin { get; private set; }
3737

38+
public List<GameObject> ignoreList { private get; set; }
39+
3840
public Rays()
3941
{
4042
ISetDefaultRayColorMethods.setDefaultRayColor = SetDefaultRayColor;
@@ -204,7 +206,7 @@ void OnProxyActiveChanged(IProxy proxy)
204206
var uiDistance = source.eventData.pointerCurrentRaycast.distance;
205207

206208
// If the distance to a scene object is less than the distance to the hovered UI, invalidate the UI raycast
207-
if (!isManipulator && raycastObject && sceneObjectDistance < uiDistance)
209+
if (!isManipulator && raycastObject && sceneObjectDistance < uiDistance && !ignoreList.Contains(raycastObject))
208210
return false;
209211
}
210212

Scripts/Core/EditorVR.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ void Awake()
194194
var intersectionModule = AddModule<IntersectionModule>();
195195
this.ConnectInterfaces(intersectionModule);
196196
intersectionModule.Setup(spatialHashModule.spatialHash);
197+
// TODO: Support module dependencies via ConnectInterfaces
198+
GetNestedModule<Rays>().ignoreList = intersectionModule.standardIgnoreList;
197199

198200
AddModule<SnappingModule>();
199201

0 commit comments

Comments
 (0)