Explorar o código

Raycasting Bug half fixed

Furkan Karakocaoglu %!s(int64=2) %!d(string=hai) anos
pai
achega
7fe2294cd9

+ 4 - 0
testumgebung/CrowdModelling/Assets/Depictions_Years/Scripts/Logging/CastingToObject.cs

@@ -1,6 +1,7 @@
 using System.Linq;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.EventSystems;
 using UnityEngine.AI;
 
 public class CastingToObject : MonoBehaviour
@@ -173,6 +174,9 @@ public class CastingToObject : MonoBehaviour
     {
         if (Input.GetMouseButtonDown(0))
         {
+            if (EventSystem.current.currentSelectedGameObject != null)
+                return;
+
             var ray = currentCam.ScreenPointToRay(Input.mousePosition);
             if (Physics.Raycast(ray, out theObject, float.MaxValue, layer))
             {