playMaker

Author Topic: Activate GUI button when clicked (not released)  (Read 1458 times)

WelchComp

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Activate GUI button when clicked (not released)
« on: October 11, 2014, 05:33:45 PM »
I have a playmaker GUIbutton in my Unity scene and I want it to send an event the moment I click on it instead of when the GUIbutton is released. I need this because users could (and likely will) drag the mouse off of the GUIbutton before releasing their mouse button. When doing this action the event is never sent.

Is there any way I can accomplish this?
« Last Edit: October 11, 2014, 05:35:36 PM by WelchComp »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Activate GUI button when clicked (not released)
« Reply #1 on: October 12, 2014, 10:19:05 AM »
Are you using legacy gui or ugui?

WelchComp

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Activate GUI button when clicked (not released)
« Reply #2 on: October 13, 2014, 09:58:30 PM »
Im not sure how to tell. I'm using Playmakers UI action scripts and the one I selected is called "GUI button". and it's stored under a category called "GUI"

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Activate GUI button when clicked (not released)
« Reply #3 on: October 14, 2014, 04:19:51 AM »
Legacy GUI.

So as far as I know there is a way to do this in Unity, but there isnt an action for it. With Legacy GUI they use two separate button types to handle this situation, they're Button and RepeatButton.

Button returns a bool true when the click is released. RepeatButton returns true every frame that it is depressed. There is only an action for Button right now for Legacy.

On the other hand in 4.6 I'm pretty certain that I recall seeing this functionality built into the button system for the new uGui. Someone please correct me here if I'm wrong.