zoukankan      html  css  js  c++  java
  • ngui点击与场景点击判断

    注:NGUI 组件上加上 BoxCollider 并设置区域大小

    public void OnMouseDown()
        {

            if (UICamera.hoveredObject == null)    //场景的点击
            {
                a = GameObject.Find("box");

                if (b == false)
                {

                    a.renderer.material.color = Color.red;
                    b = true;
                }

                else if (b == true)
                {

                    a.renderer.material.color = Color.yellow;
                    b = false;
                }
            }

        }

    或用射线检测

    Ray ray=UICamera.mainCamera.ScreenPointToRay(Input.mousePosition);// 向屏幕发射线
    RaycastHit hit;
    if(Physics.Raycast(ray,out hit,200))//射线的碰撞检测
    {
         print("点到NGUI");
    }

  • 相关阅读:
    TestNG详解-深度好文
    自动化测试用例getText()获取某一个元素的值返回null或空
    Python装饰器
    工资管理系统
    并发,并行
    TCP/IP协议
    tcp长连接和短连接
    tcp注意点
    文件下载器
    tcp服务器
  • 原文地址:https://www.cnblogs.com/ghost240/p/4175673.html
Copyright © 2011-2022 走看看