playMaker

Author Topic: Can I have a Touch triggering an Input?  (Read 3231 times)

Col. Phil Bilko

  • Playmaker Newbie
  • *
  • Posts: 45
Can I have a Touch triggering an Input?
« on: June 27, 2013, 09:24:01 AM »
Hello All;

What I am trying to do is have a touch event trigger an input. For example I have the keyboards arrow keys move the character, left, right, up and down (Side scrolling game project) What I would like is if the player touches a NGUI button on the screen it would trigger an input event based on left , right, up or down. Also when the users touch ends it acts like the input was released.

Does anyone have a recipe for this?

Thanks so much for your time.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can I have a Touch triggering an Input?
« Reply #1 on: June 27, 2013, 02:56:40 PM »
Hi,

unfortunatly ( and annoyingly enough), Unity Input system is not something you can set or alter this way, it's a pity really.

Two ways:

1: keep it separate from inputs, and in states, simply account for both Unity Input AND/OR your own Inputs
2: Write a custom wrapper that handles Unity Input as well as your own input. But the problem is that existing code will need to be refactored, and almost *ALL* libraries and tools relies on Unity Inputs, so this is something to be very careful with. For example, if you write your own Input Manager, then you would have to edit ALL playmaker actions that use Unity Input, and change them to use your own Input manager instead... so be careful when going down that road ( that I am actually taking sometimes, so I am not saying this is wrong, this is how it should be actually, but it makes it difficult to maintain and distribute).


bye,

 Jean