playMaker

Author Topic: easy touch management across iOS / Android  (Read 1764 times)

matthewsutherland

  • Playmaker Newbie
  • *
  • Posts: 6
easy touch management across iOS / Android
« on: March 04, 2018, 12:54:58 AM »
Hi there. I am building a game for iOS and android devices.

I am getting into the phase of building touch controls (just simple registration of touching) I am wondering if I need to handle the input differently across devices?

Also how I can best replicate touch input on the mobile devices when building the game on PC?


GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Re: easy touch management across iOS / Android
« Reply #1 on: March 04, 2018, 09:48:49 AM »
The easiest way that I have found to be cross platform friendly is to use Unity's default UI button and send a PlayMakerFSM Event. This method will register both mouse or touch events.

Example:
Lets call it "My Button"
-> Add a FSM -> In the first state add a transition called "click" -> then add a second state that holds whatever actions you want done on click.

In the Button UI -> Button Script -> add an OnClick() event (hit the plus sign in the box) -> Runtime Only -> Drag in your "My Button" -> in the drop down select PlayMaker FSM -> Send Event(string) -> then type in "click" in the box underneath.






matthewsutherland

  • Playmaker Newbie
  • *
  • Posts: 6
Re: easy touch management across iOS / Android
« Reply #2 on: March 05, 2018, 08:59:59 PM »
Thanks Goner!
For my game I was more focusing on input affecting game objects. Are global events MOUSE over etc also triggered on ios android when the user touches the screen? i.e User touches screen over an object triggers global event - mouse over.
Thanks very much for your time.