Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Lane on September 24, 2014, 08:18:33 AM

Title: uGUI Actions
Post by: Lane on September 24, 2014, 08:18:33 AM
I'm playing around with uGUI in 4.6b17 and creating relevant actions. Post requests and I'll see what I can do.

[EDIT]
Please check Ecosystem or the Wiki for the latest UI Actions. Most of the stuff in this thread was made during the 4.6 UI beta and is Legacy.
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 24, 2014, 08:21:38 AM
uGUI button event.

Really simple right now, just sends an event when a button is clicked. Be sure you use Next Frame Event for loops.

[EDIT]
UPDATED button action: http://hutonggames.com/playmakerforum/index.php?topic=8987.msg43021#msg43021

Fixes a couple of bugs. Leaving the old one here for reference as it's a different action name to avoid breaking things on update.
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 24, 2014, 09:09:34 AM
uGUI Set Slider Properties

For setting the properties of a slider.
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 24, 2014, 09:21:34 AM
uGUI Get Slider Properties

For grabbing the properties of a slider. There was a nifty value for getting a Normalized Value as well! How convenient =)
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 24, 2014, 09:45:09 AM
uGUI Toggle Event

Fire an event based on the status of a Toggle, or store its value.

Title: Re: uGUI Actions (WIP)
Post by: Dev_Sebas on September 24, 2014, 04:34:32 PM
Very good work Lane!
Will this actions replace the old UI system or with come as a package?
Cheers
Seb
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 24, 2014, 05:30:36 PM
This is all new stuff, we'll compile it into a package eventually. The Legacy GUI system is still in Unity and accessible. All of the Unity GUI is done in it, so it isn't going away.
Title: Re: uGUI Actions (WIP)
Post by: 3d_Artist1987 on September 24, 2014, 08:40:17 PM
very useful and thanks for making
Title: Re: uGUI Actions (WIP)
Post by: Lane on September 25, 2014, 02:20:50 PM
uGUI Component Enabled Flag

This is still sort of experimental. Not precisely sure how to go about enabling/disabling gui components yet or what the best approach is for this sort of action.

You can target the GameObject with the components on it and...:

Typically it seems like each gameobject will only contain one or maybe two component types, such as Button and Image, so I'm assuming you'll want to turn them all off if you are using this sort of thing and figured it would be fastest if all of the default options set it so that you could just put the action on and choose the Enabled/Disabled flag you want.

There is no issue with turning off the wrong button since its impossible to have more than one per game object, making the "all on/off" idea make the most practical sense to me.

If you need to turn off children, you'll probably be better off with Activate GameObject which turns the whole object and its children off. This is intended to target specific gameobjects or components and leave the children intentionally undisturbed.

If you want an alternative you can use Enable Behaviour, which is basically a fancy version of the Specific Component slot on this action.

The types of components you can currently affect:
Button, Text, Image, RawImage, Slider, Scrollbar, Toggle & InputField

Let me know how it goes.
Title: Re: uGUI Actions (WIP)
Post by: Ride on October 12, 2014, 03:31:45 AM
Hi Lane! Thank you so much for these, much appreciated!

Got any more in works?
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 12, 2014, 10:15:31 AM
Jean is working on some very cool stuff for the more advanced portions of uGUI and I have some revisions to make to these for gc and such but I haven't had time to do much with them lately.

Do you have any specific needs for actions here?
Title: Re: uGUI Actions (WIP)
Post by: stuhp84 on October 13, 2014, 12:30:54 PM
First of all thanks for these! I've also been in the process of checking out the new uGUI and these actions will help save some time.

Since you're taking requests I think a Set uGUI text action is something that would be awesome.
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 13, 2014, 04:09:10 PM
Get/Set Text

http://hutonggames.com/playmakerforum/index.php?topic=8318.msg39933#msg39933
Title: Re: uGUI Actions (WIP)
Post by: stuhp84 on October 13, 2014, 06:48:05 PM
Thanks for pointing me in the right direction! Did not find it through search  :-[
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 16, 2014, 11:25:25 AM
Yeah the search function is clunky. I have best results using the actual button and search screen rather than the search field in the top right of the page header.
Title: Re: uGUI Actions (WIP)
Post by: mdotstrange on October 19, 2014, 11:57:29 PM
These are a great help :D thanks!

How about actions to set/get sprites used by the ugui image component?
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 20, 2014, 04:06:59 AM
These are a great help :D thanks!

How about actions to set/get sprites used by the ugui image component?

I'll look into those this week.
Title: Re: uGUI Actions (WIP)
Post by: fudge on October 20, 2014, 05:21:33 AM
hi,

Is it possible to create an action or transition for on mouse over?

and Does it will deffinitive version for the new UI

Thanks ^^
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 20, 2014, 05:33:21 AM
Yes.
Title: Re: uGUI Actions (WIP)
Post by: fudge on October 24, 2014, 01:44:26 AM
"Yes" to what?  :-[
Title: Re: uGUI Actions (WIP)
Post by: Lane on October 24, 2014, 06:30:49 AM
Is it possible to create an action or transition for on mouse over?

Yes, either Jean's new event system will handle it or we'll make an action for it.
Title: Re: uGUI Actions (WIP)
Post by: jeanfabre on October 24, 2014, 08:42:52 AM
Hi,

 Currently, I ported the UI component event themselves, not the Actual EventSystem ( confusing I know). So mouse over, dragging and similar is still something I have to digg and find a solution to bring to PlayMaker. Hopefully I'll find a solution soon.

The current proxy will be released with PlayMaker 1.8 and Unity 4.6 when it's out of beta. Too much mess on the new UI api to release anything to the public, as things break badly between releases, thing sare definitly not yet settled.

 Bye,

 Jean
Title: Re: uGUI Actions (WIP)
Post by: doppelmonster on December 08, 2014, 01:45:56 AM
Hi,
i created a action to exchange the tint normal color of a button.


It would be cool to make this action generic so it can be used to set highlight and clicked color as well. Maybe in an update...
Title: Re: uGUI Actions (WIP)
Post by: doppelmonster on December 08, 2014, 03:51:59 AM
Set image sprite and fill actions...
Title: Re: uGUI Actions (WIP)
Post by: doppelmonster on December 08, 2014, 07:54:55 AM
set text color
Title: Re: uGUI Actions (WIP)
Post by: jeanfabre on December 08, 2014, 09:33:35 AM
Hi,

Thanks for your contribution, it's indeed welcomed!

 Maybe you want to contribute directly on the ecosystem? If you do let me know, I'll give you access so you can upload your work directly.


 Bye,

 Jean
Title: Re: uGUI Actions (WIP)
Post by: doppelmonster on December 09, 2014, 02:03:37 AM
i send you a pm
Title: Re: uGUI Actions (WIP)
Post by: Dev_Sebas on December 10, 2014, 02:56:02 PM
uGui Set Text
uGui Set Image Color
Also at my repository https://github.com/sebastiao3d (https://github.com/sebastiao3d)
Title: Re: uGUI Actions (WIP)
Post by: wheretheidivides on December 13, 2014, 07:54:30 PM
There is a bug in the UIGUI action for the button. I tried to explain it in this link.  It seems to remember old clicks and after 3 clicks or so will fire an old click.

http://hutonggames.com/playmakerforum/index.php?topic=8987.0
Title: Re: uGUI Actions (WIP)
Post by: Gua on January 09, 2015, 07:31:05 AM
uGui Set Text
uGui Set Image Color
Also at my repository https://github.com/sebastiao3d (https://github.com/sebastiao3d)
Can you add a every frame option to uGui Set Image Color?
Title: Re: uGUI Actions (WIP)
Post by: wheretheidivides on January 11, 2015, 08:18:41 PM
cool.
Title: Re: uGUI Actions (WIP)
Post by: jeanfabre on January 12, 2015, 12:53:37 AM
Hi,

 Done, I actually created a more generic action affecting ALL UI component, so you can set the color of anything.

You can get it on the Ecosystem Browser  (https://hutonggames.fogbugz.com/default.asp?W1181)or download it below:

uGuiSetGraphicColor (https://github.com/jeanfabre/PlayMaker--Unity--UI/raw/f8ad5768acd638531e4a2f15b4d0a4e17de89a19/Assets/PlayMaker%20Custom%20Actions/uGui/uGuiSetGraphicColor.cs)

 Bye,

 Jean

uGui Set Text
uGui Set Image Color
Also at my repository https://github.com/sebastiao3d (https://github.com/sebastiao3d)
Can you add a every frame option to uGui Set Image Color?
Title: Re: uGUI Actions (WIP)
Post by: terri on June 26, 2015, 10:31:54 AM
Created this action that sets the EventSystem's current selected object.

Any crits on the way I made it are most welcome!

Title: Re: uGUI Actions (WIP)
Post by: inyourbus on June 27, 2015, 09:45:58 AM
Created this action that sets the EventSystem's current selected object.

Any crits on the way I made it are most welcome!


Works great. 10/10 would recommend.
Title: Re: uGUI Actions (WIP)
Post by: jeanfabre on June 27, 2015, 10:08:10 AM
Hi,

 Thanks for this. I'll put it on the ecosystem, as well as part of the wiki package for Unity UI.

 Bye,

 Jean
Title: Re: uGUI Actions (WIP)
Post by: terri on June 28, 2015, 01:55:04 PM
awesome!
Title: Re: uGUI Actions (WIP)
Post by: phannDOTde on June 29, 2015, 09:38:55 AM
Hey terri,
I tried the action you posted and yes it does set the focus while the state is active but how would I switch to another Button using the uGUi default navigation system from there? Since when I leave the state the Button becomes "unselected" again.

What I'm trying to achive is that I got several "Screens" within one GUI and therefore I want to set the focus on a default button each time I open one of those Screens using Mouse, Keyboard or Controller.

Maybe I doing it wrong?
Title: Re: uGUI Actions (WIP)
Post by: terri on June 29, 2015, 10:27:09 AM
try this version!
Title: Re: uGUI Actions (WIP)
Post by: phannDOTde on June 29, 2015, 11:00:27 AM
hey terri,
thanks for your fast reply - but nope - the default navigation only work as I click any button at least once using the mouse, which is unsuitable if ppl are playing with a controller. All so the focus only stays active while I stay in the state your action is in. :-/
Title: Re: uGUI Actions (WIP)
Post by: terri on June 29, 2015, 11:43:45 AM
hey terri,
thanks for your fast reply - but nope - the default navigation only work as I click any button at least once using the mouse, which is unsuitable if ppl are playing with a controller. All so the focus only stays active while I stay in the state your action is in. :-/

weird, with the first version the button did seem to lose focus when you left the state but for me while testing with this new version it remained active

it never works/worked without clicking first? if so I think it's something else that is wrong, here I never have to use the mouse at all
Title: Re: uGUI Actions (WIP)
Post by: phannDOTde on June 29, 2015, 11:47:35 AM
I will test again more deeply as I get home/tomorrow and let you know if I found the issue.
Title: Re: uGUI Actions (WIP)
Post by: djaydino on June 30, 2015, 04:39:36 AM
Hi,
that is strange that your first version looses focus can you confirm that it is really doing so?

if so, would it be useful to have an option (bool) to stay or not stay focus when leaving the state?
Title: Re: uGUI Actions (WIP)
Post by: terri on June 30, 2015, 05:14:29 AM
Hi,
that is strange that your first version looses focus can you confirm that it is really doing so?

if so, would it be useful to have an option (bool) to stay or not stay focus when leaving the state?

seems that it does, I'm not yet familiar with how the eventsystem works though
yeah a bool would be best
Title: Re: uGUI Actions (WIP)
Post by: phannDOTde on June 30, 2015, 06:42:21 AM
hey terri,
thanks for your fast reply - but nope - the default navigation only work as I click any button at least once using the mouse, which is unsuitable if ppl are playing with a controller. All so the focus only stays active while I stay in the state your action is in. :-/

weird, with the first version the button did seem to lose focus when you left the state but for me while testing with this new version it remained active

it never works/worked without clicking first? if so I think it's something else that is wrong, here I never have to use the mouse at all


Hey terri,
sorry for the late reply - it works now in that way that I can instantly use the navigation with keyboard or controller - but on the off hand as an minor issue the "focused" button does not highlight showing it is preselected.
/peter
Title: Re: uGUI Actions (WIP)
Post by: djaydino on June 30, 2015, 07:59:35 AM
on the 1st version there was no Finish();

i added it here, could you try if it still looses focus?

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
/*--- __ECO__ __ACTION__ ---*/
using UnityEngine;
using UnityEngine.EventSystems;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("uGui")]
[Tooltip("Sets the EventSystem's currently select GameObject.")]
public class uGuiSetSelectedGameObject : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmGameObject gameObject;

public override void Reset()
{
gameObject = null;
}

public override void OnEnter()
{
    DoSetSelectedGameObject();

Finish();
}

void DoSetSelectedGameObject()
{
EventSystem.current.SetSelectedGameObject (gameObject.Value);
}

}
}
Title: Re: uGUI Actions (WIP)
Post by: terri on June 30, 2015, 08:09:25 AM
in my tests the last version highlights the selected button properly, doesn't lose focus when you change states and doesn't require mouse click to activate key navigation

other than the losing focus on state change, everything else should be handled by the eventsystem, I don't think it has to do with the action but with how it is set up
Title: Re: uGUI Actions (WIP)
Post by: phannDOTde on June 30, 2015, 08:30:25 AM
in my tests the last version highlights the selected button properly, doesn't lose focus when you change states and doesn't require mouse click to activate key navigation

other than the losing focus on state change, everything else should be handled by the eventsystem, I don't think it has to do with the action but with how it is set up

Might be the case ;-)

As a counterpart with some help from a friend I added a GetSelectedGameObject Action to my project - maybe someone might find it usefull. It has an option for "every frame" and all so to fire an event if the object has changed.

Title: Re: uGUI Actions (WIP)
Post by: jeanfabre on August 27, 2015, 06:20:46 AM
Hi,

 thanks, I have added (https://twitter.com/JeanAtPlayMaker/status/636890762555322368) it to the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181).

 Bye,

 Jean
Title: Re: uGUI Actions (WIP)
Post by: Lane on August 27, 2015, 06:33:23 AM
I'm going to go ahead and lock this thread since its quite old now and we have all of the proper UI solutions on Ecosystem/Wiki. The attachments will stay for reference or if someone prefers/needs them for any reason.

Check Ecosystem or the Wiki for the latest actions to work with Unity UI.

If you have new UI actions to share, please make a fresh thread for it. :)