Objects added Collider
ui-ray shielding problem: Turn off the UI above Raycast Target
Add EventSystem scene
Physics Raycaster added to the camera assembly
add the following script on the object to be detected
//引用命名空间
using UnityEngine.EventSystems;
public class EventTest : MonoBehaviour, IPointerClickHandler
{
public void OnPointerClick(PointerEventData eventData)
{
UnityEngine.Debug.Log("哎呀,被点击啦!!!");
}
}
Click on objects pop-up UI, click again to trigger an event UI