playMaker

Author Topic: Touch device, UI tap problem.[SOLVED]  (Read 3053 times)

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Touch device, UI tap problem.[SOLVED]
« on: November 21, 2020, 06:13:47 PM »
Hi guys,
So i'm making a simple game, tap to move character left and right.
I'm having a big problem when it comes to Ui. I'm using Doozy Ui, but the problems persists across any Ui solution.
I have a pause button on screen.When i click this pause button, or ANY UI element, i don't want the character to move.
I have tried a number of different solutions from different threads about the same topic
https://hutonggames.com/playmakerforum/index.php?topic=21406.0
https://hutonggames.com/playmakerforum/index.php?topic=20035.0
https://hutonggames.com/playmakerforum/index.php?topic=6164.0
https://hutonggames.com/playmakerforum/index.php?topic=9705.0

None seem to work.It functions perfectly with the mouse in editor.And the touch controls half work when using remote.They are delayed and glitchy.
But when i publish, the touches always move the player whilst touching UI.
Here are some more links to the same issue outside of playmaker

https://answers.unity.com/questions/1482927/how-to-make-ui-block-clicks-from-triggering-things.html

https://forum.unity.com/threads/standalone-input-module-touch-input-module-behavior-difference.265309/

The uGuiCheckPointerOverGUI action seems to be the closest i have gotten.All the other actions are actually quite slow, i can't move the character left and right as fast as the "touch event" action and "uGuiCheckPointerOverGUI" action.
But either way, none seem to function at all.I have tried many different combinations of actions but no luck yet.
I have a feeling it is something to so with the eventsystem.
Thanks for any help.
« Last Edit: November 23, 2020, 10:41:48 AM by 3dambit »

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Touch device, UI tap problem.
« Reply #1 on: November 22, 2020, 07:12:54 AM »
Are you using UI elements to also move the player left and right?

I envision 2 giant invisible buttons one on the left hand of the screen and one on the right side of the screen that send events from the buttons On Click() could have your movement code in each of these buttons.

What else is touch doing?

Im sorry I don't know anything about Doozy UI (only familiar with Doozy Dotween).
« Last Edit: November 22, 2020, 07:22:23 AM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #2 on: November 22, 2020, 07:32:58 AM »
Hey Kodagames.

I'm not using Ui elements to move the player. Just the 'touch event' .
I tried to use a button, but there was severe lag when moving the player.

I was hoping to use the invisible button idea, but it was responding to slow.
The 'touch event' seems to be the only action that responds quickly and instantly to touches.
When i use other actions like 'check if on gui ' or 'check if not on gui' they all seem to have a delay.

Maybe i should turn my attention to the invisible button? There must be a way to speed it up. Maybe i have overlooked it. Surely the invisible button approach must work lag free?

Thanks for you're help so far, you got me thinkin now.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Touch device, UI tap problem.
« Reply #3 on: November 22, 2020, 08:52:09 AM »
Hi.
Split up the 2 behaviors.

Set your movement similar to your first image, But add 2 Global Events "Player/Enable Move" and "Player/Disable Move"

Then on the other fsm use "UI Is Pointer Over UI Object"

Set it in 2 states, 1 checks true and the other checks false.
Then on each state, use a Send Event and send a event (Player/Enable Move" or"Player/Disable Move) to the Movement fsm.


LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Touch device, UI tap problem.
« Reply #4 on: November 22, 2020, 09:15:57 AM »
One other hack I can think of is to have a thin cube in the z with x,y for your touch area (one for left and one for right) then use Touch Object Event (one on each cube) setting movement from from each cube that is touched. The touch shouldn't register UI only those objects.

This may not be the best solution if there are other things under the UI (in the game scene) that need to be touched.
« Last Edit: November 22, 2020, 09:21:22 AM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #5 on: November 22, 2020, 12:14:20 PM »
Hi.
Split up the 2 behaviors.

Set your movement similar to your first image, But add 2 Global Events "Player/Enable Move" and "Player/Disable Move"

Then on the other fsm use "UI Is Pointer Over UI Object"

Set it in 2 states, 1 checks true and the other checks false.
Then on each state, use a Send Event and send a event (Player/Enable Move" or"Player/Disable Move) to the Movement fsm.
Just so i'm clear, the 2nd fsm.
I would start with a' touch event 'in state 1, when touched goes to state 2 with the 'UI Is Pointer Over UI Object', which checks if it is true or not, then splits into 2 states sending the global events back to player control. Is that how you mean? Thanks

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #6 on: November 22, 2020, 12:16:35 PM »
One other hack I can think of is to have a thin cube in the z with x,y for your touch area (one for left and one for right) then use Touch Object Event (one on each cube) setting movement from from each cube that is touched. The touch shouldn't register UI only those objects.

This may not be the best solution if there are other things under the UI (in the game scene) that need to be touched.
I'll  keep this in mind. Thanks

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Touch device, UI tap problem.
« Reply #7 on: November 22, 2020, 06:26:29 PM »
Hi.
No :

Fsm 1 (Is Over Ui Checker)

State 1 :
Send Event By Name (Send 'Enable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If True, Transition to state 2)

State 2 :
Send Event By Name (Send 'Disable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If Fasle, Transition to state 1)

Fsm 2 :

Have a empty state and set a global event'Disable Move'

Have your movement states and set a global event 'Enable Move' to where it fits best.

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #8 on: November 23, 2020, 06:34:24 AM »
Hi.
No :

Fsm 1 (Is Over Ui Checker)

State 1 :
Send Event By Name (Send 'Enable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If True, Transition to state 2)

State 2 :
Send Event By Name (Send 'Disable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If Fasle, Transition to state 1)

Fsm 2 :

Have a empty state and set a global event'Disable Move'

Have your movement states and set a global event 'Enable Move' to where it fits best.

I'm trying this now. I can't seem to get the "is pointer over ui object" action to respond or fire off.
« Last Edit: November 23, 2020, 06:43:51 AM by 3dambit »

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #9 on: November 23, 2020, 07:06:18 AM »
Never Mind! I am a fool. deactivated the event system in my frustration.Thanks

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #10 on: November 23, 2020, 07:35:26 AM »
Hi.
No :

Fsm 1 (Is Over Ui Checker)

State 1 :
Send Event By Name (Send 'Enable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If True, Transition to state 2)

State 2 :
Send Event By Name (Send 'Disable Move' to Fsm 2)
UI Is Pointer Over UI Object with every frame enabled (If Fasle, Transition to state 1)

Fsm 2 :

Have a empty state and set a global event'Disable Move'

Have your movement states and set a global event 'Enable Move' to where it fits best.

Hi Jay. Still no joy. I got the fsms set up as you said. Again it all seems to work okay in editor with the Mouse. However , touch sometimes detects its over UI,sometimes doesn't. If i tap fast it will stay stuck completely, after tapping away from UI. 
So basically, when i publish, i still have a similar issue, The tapping is lag free, and i can control the player perfectly, but when i tap on UI he continues to recieve input.

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Touch device, UI tap problem.
« Reply #11 on: November 23, 2020, 10:40:54 AM »
So I've tried multiple ways now, the latest version i am using a big invisible button, with global events being triggered. The lag i am referring to, turns out, is the button firing the event on mouse up!
So instead of Ui click event, i used pointer down event.
And finally, it's working, Lag free.
Thanks so much guys.
« Last Edit: November 23, 2020, 10:50:03 AM by 3dambit »