{I+=codeWee;}
[Unity3d] How to detect mouse over on New UI(4.6)
bool isOnRectTransform()
{
     PointerEventData pe = new PointerEventData(EventSystem.current);
     pe.position =  Input.mousePosition;
 
     List<RaycastResult> hits = new List<RaycastResult>();
     EventSystem.current.RaycastAll( pe, hits );
 
     bool hit = false;

     foreach(RaycastResult h in hits)
     {
         GameObject g = h.go;

         hit = ( g.name != "BackgroundEventCatcher" &&
                 (g.GetComponent<RectTransform>())
                );
         if(hit)
         {
             return true;
         }
     }
     return false;
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.