NGUI Camera's raycast hit through the UI Layer issue

Raycast into GUI?
http://forum.unity3d.com/threads/raycast-into-gui.263397/

int layer =  << ;
Ray myray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit[] hits = Physics.RaycastAll(myray, 1000.0f, layer);
int layer =  << ;//NGUI layer, TODO modify with your own
void Update()
{
if (Input.GetMouseButtonUp())
{
//UICamera
if (UICamera.currentCamera != null)
{
Ray myray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit[] hits = Physics.RaycastAll(myray, 1000.0f, layer);
if(hits != null && hits.Length > ){//hit the NGUI layer
return;
}
}
    
}
}
上一篇:字符串处理总结之二(C#StringBuilder类)


下一篇:面向对象程序设计-C++_课时14对象组合_课时15继承