- Home /
 
Can't get results from GraphicRaycaster.Raycast
This is part of a script attached to different characters I use to get mouse actions in some buttons and whatnot. It is supossed to get what action has been selected and act accordingly. It works pecfectly fine in a bunch of characters, but not in others. All of them have the same canvas assigned, which has a Graphic Raycaster component.
 public GameObject canvas;  //Already assigned in the inspector
 public GraphicRaycaster m_Raycaster;
 PointerEventData m_PointerEventData;
 public EventSystem m_EventSystem;
 if (Input.GetMouseButtonUp(0))
       {            
         m_PointerEventData = new PointerEventData(m_EventSystem);
         m_PointerEventData.position = Input.mousePosition;                       
         List<RaycastResult> results = new List<RaycastResult>();          
         m_Raycaster.Raycast(m_PointerEventData, results);
         
         foreach (RaycastResult result in results)
         {
         //No results shown in the debugger, so it doesn't get here
 
               I can't get my head around this one since I don't get any errors and the buttons respond to the click visually. Thanks for your time!
               Comment
              
 
               
              I have the same problem. Did you ever figure it out?
Your answer