zoukankan      html  css  js  c++  java
  • UGUI区分UI与3d响应

    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.EventSystems;
    using System.Collections;
    using System.Collections.Generic;

    public class TouchRayTest : MonoBehaviour {
    public EventSystem eventSystem;
    public GraphicRaycaster graphicRaycaster;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
    if (CheckGuiRaycastObjects())
    {
    Debug.Log("on");
    }
    else {
    Debug.Log("off");
    }
    }

    bool CheckGuiRaycastObjects()
    {
    PointerEventData eventData = new PointerEventData(eventSystem);
    eventData.pressPosition = Input.mousePosition;
    eventData.position = Input.mousePosition;

    List<RaycastResult> list = new List<RaycastResult>();
    graphicRaycaster.Raycast(eventData, list);
    //Debug.Log(list.Count);
    return list.Count > 0;
    }
    }

  • 相关阅读:
    java web 初学
    学习2
    学习
    上课
    Java中字母大小写的转换
    心得体会
    servlet请求
    响应设置消息体
    servlet响应-头部信息的设置
    servlet的响应(一)
  • 原文地址:https://www.cnblogs.com/xwwFrank/p/4795199.html
Copyright © 2011-2022 走看看