修复UI交互与物体交互重叠

This commit is contained in:
shenjianxing 2025-05-20 16:13:27 +08:00
parent d6b97327cb
commit 7393e6f598
2 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@ using Turing.Core.TuringInput;
using Turing.Samples;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using XMLTool;
public class Body3DObjItem : MonoBehaviour
@ -153,6 +154,11 @@ public class Body3DObjItem : MonoBehaviour
}
private void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject() == true)
{
return;
}
// 计算当前时间与上一次点击时间的间隔
float currentTime = Time.time;
if (currentTime - lastClickTime < doubleClickTimeThreshold)

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using Turing.Core.TuringInput;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class ObjectToggle : MonoBehaviour
{
@ -75,6 +76,10 @@ public class ObjectToggle : MonoBehaviour
{
return;
}
if (EventSystem.current.IsPointerOverGameObject() == true)
{
return;
}
// 记录鼠标按下的时间
mouseDownTime = Time.time;
isMouseDown = true;