playMaker

Author Topic: GUI texture button - reacts even when not pressed [SOLVED]  (Read 1786 times)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
GUI texture button - reacts even when not pressed [SOLVED]
« on: June 05, 2014, 10:58:48 PM »
Hi.

My problem is, I got this GUI Texture button with a texture applied (so it looks like a round button now). It's supposed to be a fire button (located on the right side of the screen, while the joystick is on the left), it works since when I press it, the gun fires. However it also fires when I touch anywhere on the screen. Even when I touch a place with no GUI elements. What do I need to do, so it only fires when I press the Fire Button only?
« Last Edit: June 07, 2014, 04:31:12 AM by jayf »

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: GUI texture button - reacts even when not pressed
« Reply #1 on: June 06, 2014, 02:45:30 AM »
On your GUI texture object, put an FSM on it. Add a state with a Get Button Down or Get Key Down action, choose whichever button or click you want to activate it ('Left Click' will work as a touch on a touchscreen device too), and add a global transition of 'Mouse Down' on to your state.

The set the click event to trigger an event and link it to whatever fire action you're using.

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: GUI texture button - reacts even when not pressed [SOLVED]
« Reply #2 on: June 07, 2014, 04:33:30 AM »
Thanks for the help. It still didn't work. After more googling (in case anyone else has this problem) I found that the "Touch GUI Event" action is better suited. I simply specified the Fire Button GUI as the Game Object and made Touch Began send of an event when touched. Now it seems to be working fine.