- Home /
 
               Question by 
               Democide · Jun 15, 2015 at 09:59 AM · 
                uimousecontrollereventsysteminterface  
              
 
              uUI - OnSelect: From Mouse/Pointer or Keyboard/Controller?
I am using ISelectHandler and IPointerClickHandler. Now when a UI Object is clicked, it is also automatically selected first. I want to find out if that selection was triggered by a pointer click, or by a keyboard/controller event.
Since OnSelect only has access to the BaseEventData I have no idea how to do this. My first idea was to use the input module involved, but since I'm using the Standalone module, both mouseclick and keyboard/controller event come from the same module, so I can't use that to differentiate.
 void OnSelect(BaseEventData eventData) {
     if ( !Input.GetMouseButton(0) ) {
         Do something for mouse;
     }
     else {
         Do something different for keyboard/controller;
     }
 }
Any ideas?
Update: I've found a solution by asking the Input Module if the mouse was pressed, but this seems somehwat hacky, and won't work for touch inputs.
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                