Blogger Information
Blog 95
fans 0
comment 11
visits 248852
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
三维世界中判断鼠标左键是否点击了方块Cube
龍__遇见彩虹的博客
Original
1757 people have browsed it

EventSystem.IsPointerOverGameObject

public bool IsPointerOverGameObject();

public bool IsPointerOverGameObject(int pointerId);


Description:

Is the pointer with the given ID over an EventSystem object?


例子:

using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;//调用系统事件
public class MouseExample : MonoBehaviour {
    void Update () 
    {
        // Check if the left mouse button was clicked
        if(Input.GetMouseButtonDown(0))
        {
            // Check if the mouse was clicked over a UI element
            if(EventSystem.current.IsPointerOverGameObject())
                {Debug.Log("Clicked on the UI");
            }
         }
    }
}


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post