This commit is contained in:
yulong 2024-01-29 11:28:34 +08:00
parent 938bc95dfd
commit efa7f0fe20
2 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class GlobalFlag
{
@ -27,4 +29,13 @@ public class GlobalFlag
/// 红方蓝方
/// </summary>
public static int blueOrRed = -1;
public static bool CheckGuiRaycastObjects(EventSystem eventSystem, GraphicRaycaster graphicRaycaster)
{
PointerEventData eventData = new PointerEventData(eventSystem);
eventData.pressPosition = Input.mousePosition;
eventData.position = Input.mousePosition;
List<RaycastResult> list = new List<RaycastResult>();
graphicRaycaster.Raycast(eventData, list);
return list.Count > 0;
}
}

View File

@ -256,6 +256,10 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
//if (CheckGuiRaycastObjects())
//{
// return;
//}
if (EventSystem.current.IsPointerOverGameObject())
{
return;