fix layer mask detection
This commit is contained in:
@@ -3,12 +3,12 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InGameMouseHandler:UnityEngine.Object
|
||||
public class InGameMouseHandler : UnityEngine.Object
|
||||
{
|
||||
private LayerMask _selectableLayerMask;
|
||||
|
||||
|
||||
private LayerMask _walkableLayerMask;
|
||||
|
||||
|
||||
private WaypointVisual _waypointVisual;
|
||||
|
||||
private Ray _ray;
|
||||
@@ -21,11 +21,11 @@ public class InGameMouseHandler:UnityEngine.Object
|
||||
public InGameMouseHandler(Camera camera)
|
||||
{
|
||||
_camera = camera;
|
||||
_selectableLayerMask =LayerMask.NameToLayer("Selectable");
|
||||
_walkableLayerMask = LayerMask.NameToLayer("Walking");
|
||||
_selectableLayerMask = LayerMask.GetMask("Selectable");
|
||||
_walkableLayerMask = LayerMask.GetMask("Walking");
|
||||
|
||||
var waypointPrefab = Resources.Load("WayPointSign", typeof(WaypointVisual)) as WaypointVisual;
|
||||
_waypointVisual =Instantiate(waypointPrefab);
|
||||
var waypointPrefab = Resources.Load("WayPointSign", typeof(WaypointVisual)) as WaypointVisual;
|
||||
_waypointVisual = Instantiate(waypointPrefab);
|
||||
|
||||
GameManager.Instance.Input.PlayerAction.PointClick.performed += ClickToMove;
|
||||
}
|
||||
@@ -58,10 +58,10 @@ public class InGameMouseHandler:UnityEngine.Object
|
||||
public void Update()
|
||||
{
|
||||
_ray = _camera.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||
if(EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
return;
|
||||
}
|
||||
//if(EventSystem.current.IsPointerOverGameObject())
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//hide rounded menu
|
||||
if (Physics.Raycast(_ray, out var mouseRaycastHit, 100f, _selectableLayerMask))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user