Playmaker Forum

PlayMaker News => General Discussion => Topic started by: WelchComp on October 11, 2014, 08:33:45 PM

Title: Activate GUI button when clicked (not released)
Post by: WelchComp on October 11, 2014, 08: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?
Title: Re: Activate GUI button when clicked (not released)
Post by: Lane on October 12, 2014, 01:19:05 PM
Are you using legacy gui or ugui?
Title: Re: Activate GUI button when clicked (not released)
Post by: WelchComp on October 14, 2014, 12:58:30 AM
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"
Title: Re: Activate GUI button when clicked (not released)
Post by: Lane on October 14, 2014, 07: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.