Download

UMG and touch on Android - any issues ?

Are there any hidden obstacles I should be aware of when implementing UMG UI for Android games?

Thanks

lots of hidden invisible horses that are just waiting to kick you in da butt.
I list what i remember from my android fun times:

  • be prepared for device to change screen dimentsions at any time, ie. flipping portrait/landscape, or dragging out tool bar, resizes screen
  • there is no easy way to get correct dimensions in umg, well it is easy to do, but hard to discover what is proper way, and sadly i forgot this
  • touch interface has different orientation and scale that umg coordinates. Also screen coordinates (if you project 3d world to camera plane) are different. Then on top of all that if you run emulation of your project in windows you have different coordinates (because it uses full screen values while game is emulated in window). So a bit of mess here, can be sorted out with simple code, but you need to test it a lot.
  • buttons in umg do not really work with multitouch. Best example is doing simple fire button. If you touch it and drag finger out it will not notice that. It is also impossible (or i could not find a way) to calculate screen coordinates of widget in umg. So you cannot simply get box dimensions that button uses and check if touch is in that box or not.

Sounds like a mess :confused:

So, is there another way of making UI for Android touchscreen ?

Yes there is. I found that easiest way is to make your own procedure that traces every touch location. Then tell buttons they are used or not used (but at that point its better to use your own fake button widget that just looks like button). But that should be only for game screen where you need to have game like gui. For all other things that need less of game and more of traditional gui UMG is better.

So i made my own touch processing for gameplay shooting and generally playing game. Then i use regular umg widgets for high score, nick changing, selecting items from inventory etc.

Btw. I really got stuck with finding out SCREEN location and dimensions for widgets. Maybe that is improved now since year ago. With that it would be much easier to make working GUI that reacts to all possible case with multitouch input.

Bottom line is that UMG is designed for single touch/mouse imput, it lacks when you can press 4-5 spots at once. But anything where you may expect single touch works fine.