Announcement

Collapse
No announcement yet.

[Solved] Can't figure out the Input Mode for a RTS-style game

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Can't figure out the Input Mode for a RTS-style game

    Hello,

    I can't seem to find a decent solution to my issue regarding UI and input modes for a small RTS-style game.

    My main hassle seems to be related to the fact that I want keyboard inputs to be working ALL the time. I don't want the UI to steal controls once something is clicked and have to click again in the viewport to regain controls. Obviously though, a click on the interface should still prevent a click in the "world" context (like selecting a unit), but nothing more.

    For instance I have a small spell icon on the bottom on the screen. I'd like to be able to click on it, hold the spell "under my cursor", move freely around the map with the keyboard still, and click on the screen a single time to cast the spell at the location under cursor.

    I tried numerous ways, using both Set Input Game Only and Set Input UI/Game Mode. Forcing Setting Set Input Game Only after any click on the interface seemed to give me a starting point but still there was a hiccup in the keyboard inputs and to click the interface seemed to require two clicks somehow.

    I'm really not sure how to proceed here. Any help?
    Thanks

    Solved : turn off "isFocusable" in a widget and it'll no longer steal keyboard input.
    Last edited by Cremuss; 09-03-2018, 03:57 PM.

    #2
    What you're describing is the default behaviour, actually:

    https://i.gyazo.com/2c03026bda0e0ad2...91e21573d8.mp4

    If you explicitly set the Input Mode to UI only, the controller will stop receiving input, of course. UI can steal keyboard focus if you flag a widget as isFocusable. If unhandled, it will be passed to the controller, though.
    Last edited by Everynone; 09-03-2018, 08:32 AM.

    Comment


      #3
      Oh man, thank you Everynone! I have searched for everything but that. I wasn't aware of that option.

      Can't believe it was as simple as that Works wonders with "isFocusable" turned off. Thanks again!

      Comment

      Working...
      X