Playmaker Forum
PlayMaker Updates & Downloads => Official Action Updates => Topic started by: Alex Chouls on April 08, 2012, 01:06:00 AM
-
[EDIT: full package for NGUI support available on the wiki:
https://hutonggames.fogbugz.com/default.asp?W1111]
This actually isn't an action, but a component that forwards NGUI Events to a PlayMakerFSM.
Put this component on the GameObject with the Collider used by NGUI.
Choose an FSM to send events to (leave blank to target an FSM on the same GameObject).
You can rename the events to match descriptive event names in your FSM. E.g., "OK Button Pressed"
NOTE: Use the Get Event Info action in PlayMaker to get event arguments.
See also: http://www.tasharen.com/?page_id=160
This is a first step in NGUI integration. More NGUI actions coming soon!
NOTE: You can already interface with NGUI quite a bit using the Get/Set Property actions...
EDIT: Added a few screenshots to show usage.
-
Perfect! I just grabbed NGUI 2 days ago. Loving it so far!
-
This is awesome!
-
Cool! NGUI users please post requests for actions so we can prioritize the work.. Thanks!
-
wann use playmaker to get & set the value of the slider :)
-
I would like to use ngui for highscore display, can I use playmaker to output a string to ngui?
-
wann use playmaker to get & set the value of the slider :)
I just checked, and you can do this with Get/Set Property actions.
I suspect that you can access a lot of NGUI this way...
-
I would like to use ngui for highscore display, can I use playmaker to output a string to ngui?
Yup. Seems like Set Property works. Set the "text" property.
-
Please post your experiences using Get/Set Property with NGUI. Are there things that can't be achieved with them, and need custom actions? Or actions that are so common they should be custom actions for convenience?
-
Working on my switching my GUI system from UnityGUI to NGUI now, will delve into this and post what I find/need. Taking me a while though currently, only so many hours in the day :)
-
Ok, maybe I just haven't had my cornflakes this morning, but how do you make the Target Object in your screenshots above actually point to the Object type UILabel instead of UnityEngine.GameObject?
*edit* Cool, got my cornflakes - I need to drag the *component* not the GO itself...durr. It's a bit annoying that I have to lock the FSM I'm using (manager) when I select another GO, but I don't think that can be helped :)
-
Don't worry. I won't tell you how many bowls of corflakes it took for me to figure that out one morning! :o
-
Is there some way to determine which NGUI component sent the event to a FSM?
*edit* Figured out a way. I attached a FSM to the component. Then used the script to send an event to the same component. From there I can forward both the event and the Object reference to the Controller FSM. Convoluted, but works.
BUT. Now I have found something that is driving me completely nuts. How do I change the color of an object? Like a SlicedSprite for example? I can drill down through UISlicedSprite->Inherited->color... But I cannot set it to anything.
-
Sorry there was a bug in 1.3.2 with color properties. This is fixed in 1.3.3. PM me if you want access to the beta...
-
Cool! NGUI users please post requests for actions so we can prioritize the work.. Thanks!
Add +1 to NGUI actions, another user here...
-
I wanna set postion of an Ngui's panel allow an object's postion
but ngui's camera and the main camera is different camera,
could some action to easy make Ui element and object can be well fit?
like the pic I show
-
Thank you so much for this thread!
-
Could you show an example of set property on ngui label for highscore?
I'm a bit lost how to set it.
normally I use "set GUI text", would love an action for "set NGUI text"
Thanks
-
Here's a screenshot.
You need to drag the UILabel component into the Target Object slot, then select the "text" property.
TIP: Lock the Playmaker selection when dragging components from other GameObjects. Here the FSM is on the UI Root (2D) object, but targets the UILabel component on a child.
BTW, this will be even easier in 1.4 - you can just drag a component onto the State panel to make a Get or Set Property action that targets that component. Or drag it onto the Variables panel to make a variable containing the component! ;D
-
Thanks , setting the lock button helped me solve the mystery.
Initially I was looking for a text property on the game object, but then found the way to set the script property.
-
i'm having a bit of trouble working out how to get this to work. (i'm new to playmaker and have come over from uSCript) I will give a very simple example or what i'm trying to do.
I have a simple NGUI image button on the screen and would like to trigger an FSM attached to the button itself when it is clicked.
So far I have attached the provided script from the OP to the button and have created an FSM on the button. This is the part I can't figure out. In the instruction in the OP it says to use a Get Event Info action in the FSM which I have done but I don't know what to set in the Get Event Info action. I tried creating a GameObject variable with the button in it but you can't add the NGUI buttons as a GameObject. I tried adding it as an Object of type UIImageButton but you can't do that either. I know it's probably something simple I'm just not doing right. If someone could point me in the right direction that would be great. Thanks.
Also is there a tutorial on writing your own actions and does uScript and playmaker play nice together?
Thanks
-
1. Add the UIEventsToPlayMakerFSM script to the NGUI Button.
2. Drag the PlayMakerFSM that you want to send events to into the Target FSM field.
3. Add the NGUI events you want to respond to in the FSM (E.g., OnClick etc.)
4. Respond to the events :)
I've attached a screenshot that shows the final setup.
You only need to use Get Event Info if you need more information about the event.
Some docs on writing actions: https://hutonggames.fogbugz.com/default.asp?W166
You can also find a lot of tips on making custom actions on the forum, and Playmaker ships with the source code for hundreds of actions as examples.
I haven't spent a lot of time with uScript... In theory Playmaker and uScript should work quite well together :)
-
Thanks very much. That has helped me out a lot. Very usefull info.
-
it seen that using set property cannot change ngui's sprite color, is that some way to change it??
-
How do i select the fsm off an object and paste it into UIevents to playmaker on my ngui button. I can only see one thing at once in the inspector?
Thanks Byron.
Sorted, had a dummy object in the scene to receive the event, as my characters are created at run-time.
Thanks.
-
im sure people speak in riddles here haha,
im still struggling with this,creating a simple button,i added a playmaker fsm to the uiroot 2d and also a uievents to playmaker fsm
on the button ive added another fsm and dragged that fsm to the target fsm on the uiroot 2d then on the button fsm i created a OnClick event added that to my idle state then connected that to a clicked state now im not sure were to go from here
can anyone help or create a simple scene demonstrating the use of ngui and playmaker
thank you
-
So I bought NGUI....I had the free version and now my work is all messed up caused I tried to translate.
-
... and also a uievents to playmaker fsm
The UIEventsToPlayMakerFSM script should go on the button (or the object with the Collider). All it does is forward NGUI Events to a PlayMakerFSM. But it has to go on the NGUI object generating the events. Otherwise it doesn't do anything! :P
-
I just want to say that finding this thread today was like finding a pot of gold. I'm just starting with Unity and have been learning both of these plug-ins. Now the power of them is combined. Thank you!
-
So if I get this straight...you're saying just try to use both together there's no real set up?
-
would anyone know how i would deal with the popup list,i dont actually have individual colliders for different buttons it generates,it also generates the buttons at run time,
thanks
-
would anyone know how i would deal with the popup list,i dont actually have individual colliders for different buttons it generates,it also generates the buttons at run time,
thanks
+1
-
Maybe instead of collision boxes, you could use a 'Get Property' on the UIPopupLists's textLabel's property, set it to everyframe, then you could use a 'String Compare' set to everyframe, to watch for any user changes to fire off an event. :-\
-
This came at just the right time! Does anyone know how to block actions behind a button? For example, if you click a button, you don't want anything to happen to game objects behind the button.
-
http://www.tasharen.com/?topic=prevent-click-through
-
http://www.tasharen.com/?topic=prevent-click-through
Thank you! :D
-
it seen that using set property cannot change ngui's sprite color, is that some way to change it??
is there a solution for this? trying to do it by set property > inherted > color but it resets the variable when i start
-
Hi,
I guess you mean that it set the color on a gui component when you actually want to get it and work from there:
So: Use "get property", store the color in your variable, and then you modify this color and inject it back using "set property"
bye,
Jean
-
Hi
i have 2 FSMs in one object and i want to send the OnClick to FSM #2 but the script only send the commands to the first FSM . any way around this ?
-
Hi,
You can send an event to a gameObject which will send that event to all the FSM attached to this gameObject.
Have you tried that? What technic do you use currently?
bye,
Jean
-
Hi
i have used the script in the first post .
and i ended up deleting the 2nd FSM , no mater how i try it will never trigger the action on the second FSM
-
Hi,
If you are sending a message to the gameObject, then yes, the first component is picked up.
the solution when that happens is to reference the Fsm component directly, the trick is to drag the component itself, not the gameObject, because dragging the gameObject will pick the first FSM component.
Bye,
Jean
-
How would i go about doing an OnPress released (or up) instead of pressed? I know OnPress is set up as a bool.
How do i make a playmaker action that sends OnPress as up instead of down?
Edit**
Fixed
OnPress event seems to toggle the bool for me. Heres a picture.
(http://s13.postimage.org/ajm50gu2v/Screen_Shot_2012_07_03_at_3_19_19_PM.png)
-
i dont know if its a playmaker related problem but i will ask ;D
why does all action like mouse pick and raycast dosent detact the objects on the NGUI ? how can i do it right ?
-
I'm still learning NGUI myself, but this is what I've observed...
If you look in the scene view, you'll notice that your NGUI items are very small compared to everything else in the scene. NGUI uses a different camera than the one you use for your scene. So when you look in the game view, you see the output for both cameras. If you try to use raycasting on the main camera, your chances of encountering an NGUI item is unlikely because what you see in Game View is not how things are actually positioned in Scene View. (I tried to change the size of things viewed by the main camera, but NGUI just re-sized its components to be even smaller.)
I'm not sure how NGUI makes it possible to detect button clicks in Game View. To detect raycasting, I'm putting an empty game object with a box collider behind the NGUI items, using the main camera. If you figure out a better way, maybe you can share? .
-
Thank you for the info :)
i already know that it uses another camera ,
what i have now is some game objects that i place with the gui camera and i cant raycast to them .
but i guess we need to look more into the examples .
-
sorry for the double post .
try SetMainCamera action
-
Thanks for this. It's helped my work out a great deal.
-
Is there some way to determine which NGUI component sent the event to a FSM?
*edit* Figured out a way. I attached a FSM to the component. Then used the script to send an event to the same component. From there I can forward both the event and the Object reference to the Controller FSM. Convoluted, but works.
I've run into this same problem, but I've found that putting 1 FSM on each button in a menu with 100 button causes serious lag, even if all FSMs are turned off. Is there a way that we can reference a FSM that is not on the same button that contains the UIEvents to PlayMaker FSM script?
Currently, when I attach "UIEvents to PlayMaker FSM" script to a button, and link it to my GameManager FSM on another game object, nothing happens.
[UPDATE]
I found the problem. When you attach the game object that contains the FSM to the "UIEvents to PlayMaker FSM", the first FSM is always referenced. There is no way to tell the script which FSM on the game object you want to reference.
Is there any possibility that an update can be added to the "UIEvents to PlayMaker FSM" script so that we can select a specific FSM, not just the first one on the game object?
-
"There is no way to tell the script which FSM on the game object you want to reference. "
It is pretty simple though a little tedious. Select the Object with "UIEvents to Playmaker FSM" script, then lock the Inspector (right click on Tab). Open a 2nd Inspector tab in different window, and select the Object with FSMs. Then drag the correct FSM component into the "Target FSM" slot of your button. Works like a charm!
-
is there a way to use the "call when finished" on the animation scripts to send a fsm event?
for example if a button has pressed, after its animation has played from ngui it triggers an event on the active state in a specific fsm.
-
I'm trying to figure out a way to detect an OnPress(up/released). Or possibly a way to check an NGUI button's isDown bool variable. Can't seem to find "isDown" anywhere in GetProperty for the UIButton. The post in the preceding page by alternativee30 seemed promising but I'm having a strange problem with that approach: Clicking/unclicking does indeed toggle, but for some reason, pressing/unpressing will fire the OnPress event twice, effectively keeping the FSM at its current state. I've been trying to figure this out for a while, I've scripted plenty of NGUI buttons but can't seem to get it to work with PlayMaker. Any help's appreciated!
-
the first post explains how to do that, u need the script that has been made and attach it to the button, this will alert playmaker on these functions.
-
Sorry thought it was obvious that I was using that script since I was talking about using the events. The problem is on touch input for the button it fires the event twice, but on mouse click input it only fires it once (as desired).
-
Hi,
I know for sure that ezgui has a similar problem, due to some internals of Unity, and I had to implement a flag and a timer to prevent the second event to do anything.
it might the case with ngui. You should contact ngui and ask if they have problems with double detection of mouse/touch input.
bye,
Jean
-
would anyone know how i would deal with the popup list,i dont actually have individual colliders for different buttons it generates,it also generates the buttons at run time,
thanks
+1
+1 here as well. Was there ever any movement on this? I am using popup Menus and don't see a way to retrieve the selected item.
Thanks!
-
Cool! NGUI users please post requests for actions so we can prioritize the work.. Thanks!
In addition to the Popup Menu/List interaction, I'd love a way to create NGUI elements during runtime.
-
would also love to know how to separate popup list events to send to fsm. seems easy enough but an answer is totally eluding me
-
Hi,
Such popup list and drop down are actually quite serious to implement if you ant it to be done right and behaving like we are use to. So not trivial I am afraid, especially if you want to design it at runtime.
I would go for prefabs at the moment, building your UI component using prefab and then instantiate it
as for the actual popup content, ArrayMaker to the rescue :)
If you can set the text value of a nGui component already, then you have all the building blocks to play around with this.
like with all these components, the key to achieve something when you don't know where to start is to define the specifications. Write a document explananing with as little word as you can the mechanism, and you will then be able to extract the various internal feature of it. Then you cut down the work in small chunck
-- Can I inject a text in a ngui label component with playmaker
-- Can I create that text at runtime using a prefab and maybe a fsm inside it so I can simply fire an event to it with a string in the event data so that the text gameObject itself inject this text in the gui label.
-- can I manage a given number of text field.
-- Creating and removing items on demand based on the content of an ArrayMaker List of or hashtable
etc etc
Each if these smaller feature are easier to tackle because precise. Once you have them all covered, you put that together and shape your final UI component.
Go through this process, if you are having problem down the road, I'll make a working example. I never provided anything with nGUI yet, so it could be a starting point as many of you do use nGUI.
bye,
Jean
-
I have been experimenting and making a lot of headway with ngui of late, though I have came upon a problem with ngui that I may be able to solve with manual control using playmaker, however playmaker doesn't have an action for it yet. (I have posted on the ngui forums but not sure what they are like over there for implementing ideas etc.)
I would like to set the play direction of a UIbutton animation script (and others that use this field), the set properties has most of the other properties in that script but doesn't give access to this one, I can change it at run time through the editor so I believe it should be possible with playmaker.
-
I am not sure if this will help anyone but the play direction is controlled as part of the animation clip, along with name etc, the code they are using
int pd = -(int)playDirection;
Direction dir = forward ? playDirection : ((Direction)pd);
ActiveAnimation anim = ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished);
if (resetOnPlay) anim.Reset();
-
Hi,
ok, here it is:
http://hutonggames.com/playmakerforum/index.php?topic=2486.0 (http://hutonggames.com/playmakerforum/index.php?topic=2486.0)
bye,
Jean
-
I have a project where the user interacts with a large list of buttons. I am using the UIEventsToPlaymaker script to send an event from each button to my FSM.
My list is several hundred entries long, so I can't give each button a unique event to send. How can I acquire the identity of the button that last sent an event? Ideally I want to click any button in the list, and know which button it was.
Thanks in advance!
-
I had a similar problem. Maybe you could try this workflow:
1) player clicks button
2) button sends event to FSM
3) In FSM, use Get Event Info to grab the Game Object, which is the button.
4) Grab a property of the Game Object that identifies it & use this to identify your button.
This is what I did:
1) attached ButtonID script with an empty ID to button Game Object template
2) When game starts, used a FSM to generate 100 buttons + set the value of the ID field in the ButtonID script.
3) When player clicks button & the event goes to the FSM, I use Get Event Info to get the button game object. Then I use Get Component to get the ButtonID script, then use Get Property to get the ID in the ButtonID script.
-
*bumpity*
So, I've tried multiple things here:
ScreenPick
MousePick
MousePickEvent
GetEventInfo
So far none of them have worked. The *Pick actions never seem to be able to grab the NGUI elements, even when they're masked out to only the NGUI layer, and the main camera is set up to do the same (excluding everything else).
GetEventInfo had some promise, but when I set a "Sent By Game Object" to a variable to catch the Button sending the event, it instead returns the GameObject that the FSM is on.
So I had to turn a project prototype in this morning that was hacky, hacky, hacky. Just terrible. It was only acceptable because it was just a prototype, but I *need* to find a proper solution to this. It shouldn't be that difficult, so I would greatly appreciate some assistance from someone who might know how the NGUI/Playmaker interface script works, or something else I might have missed.
Thanks in advance.
-
Could I get some help with this? Should I move it to the "Help" forum?
-
Hi,
Could you make a small project to hilite your struggle, I'll have a look at it then,
bye,
Jean
-
Any example on how playmaker works with NGUI popup menu ?
-
So I've been following the this thread, and recently bought ngui. I think I get most of it. I tried to setup a simple button to test, but when I try to Get Property > onPressEvent, it only gives me the option to store it as a string.
Is that correct? When I look at the NGUI events, it says onPressEvent is a bool.
I'm a little confused. I've attached an image. What am I suppose to do with the string?
[updated]
Ok I guess I also needed cornflakes. I read the post made by Alex a few more times and it finally sunk in. On my FSM, I needed an event "OnClick". I was way over thinking as usual. Instead it's very simple.
Some reason I kept thinking I had to use GetProperty to check on the "onClick" and then store it in a bool.
-
I know I have asked a lot of the community and have had lots of help with everything :p however I have another small request.
with the UIEventsToPlaymakerFSM script, is there any chance of getting a slight extension to the onclick, could we have the option to set a int variable in the targeted FSM to a number.
I know this is kinda specific, however I hope to use this to keep the FSM's clean, I have a lot of buttons and for each button it sets a int value to be used elsewhere, it seems a bit excessive having 50+ events and corresponding state just to set an int value.
-
So I'm using NGUI for my menu's and i've hit an issue
I use Get/Set from playmaker to Set the Panel i want to Active = False
the idea is this should disable the panel and it would be inactive until its needed
problem is, even though its inactive, i can still click on it, sound effect plays and it works still
anyway to fix this or am i disabling panels wrong?
-
How to disable NGUI Panels in Playmaker explained;
the Get/Set can disable things perfectly fine but its not a recursive (what ever that is)
I looked into it more and PlayMaker has a recursive disable/active script that can auto reverse on state exit
"Activate Game Object"
-
I know this is quite an old thread now... but I've been trying to figure out how to use the "input" asset on NGUI.
What I want to do is:
1. Have an input asset that let's user type name and then save as a string so that I can use it in other FSM's
2. Much the same as above but for a chat room, I'm not sure if this is the same as above which is why I have asked it separately.
Thank you
-
Solved issue number 1 (See image). I dont know if this is a good method but it works perfectly fine. Let me know if this is not a good method. I am using photon in this project.
-
Is there a way to create NGUI Items and make them Children of the UI-Root-Object via FSM?
-
See my attachment. Yes, if this is what you are trying to do.
-
Ah, i see. And now, a screenshot of the Actions :D :D :P
I'll try it, thank you.
-
So, will this work if i put two of them on them? for instance, say i have two FSMs that i want to get information from (one being "onHover" and another being "onClick"... the "onHover" being a way to tell my monitor system to pass the information to the appropriate systems that any clicks while the mouse is over this spot to be disregarded, the other to open up a character sheet/skill-tree.)
or would the two scripts being on the same object cause issues?
-
How can i make an FadeOut Effect (linear changing the AlphaValue from 255-0)with UI Widgets?
I triedto manipulate it via SetProperties but couldn't achieve any good results :/
-
Use set properties as you said, it should work, alternatively use the script attached (originally from the NGUI forums) and put it on a panel or anchor to control all of the sub objects transparency.
warning that with the script it uses a scale of 0-1 not 0-255 and that if you change any of the sub objects transparency manually then it will reset to the scripts value on the next frame.
PS. use ease float action with the set property to easily animate the fade with the script below
-
Mhm, i am trying it without the script.
So i made my first state:
(http://www.kingpic.net/uploads/bildschirmfoto_2013-03-07_um_19_48_41.png)
And that is my second state
(http://www.kingpic.net/uploads/bildschirmfoto_2013-03-07_um_19_51_26.png)
Doesn't work. I know it's not that difficult, i just didn't figured out yet the proper using of Properties and Variables.
-
the only reason to use to get property in this instance is if you want to animate from a partially faded UI element that you dont know how much has faded.
If this is the case, this would be your start value (ease float "from value")
otherwise remove the get property and create a Set property after the ease float.
set the alpha property in the set property action like you did with the get property
and then set the set property "every frame" check box to active
-
It's otherwise, yeah. Tried that out:
(http://www.kingpic.net/uploads/bildschirmfoto_2013-03-07_um_20_33_36.png)
Doesn't work. It kind of ignores the EaseFloat-Action (well, it goes through the action, but nothing happens), only when i fool around with the AlphaValue in the "Set Properties" Action it makes a difference, and i don't just want to set it to 0, but to yeah easefloat it :D
And i don't understand this approach quite well. My FSM on my GameObject has to know that i want access its UISpriteComponent and change the Alpha-Value. I don't get how i can make an "Ease Float"-Action on the float-settings BEFORE telling it which float (the Alpha Value) i want to manipulate.
-
think of it as the easing float and the alpha separately.
your setting a float number with the ease float - at this point this is just a generic decimal number, can be used for anything from object position, time to wait, how much force to use OR an alpha for a gui element
so this number will no matter what you do with it animate from the low number to the high.
you are then using this number after to change the assigned number to the alpha value (or anything else that you want to effect with a float)
to put this into perspective, you could even generate this animated float and not use it for anything - pointless yes - but playmaker will keep this number going, further more you could then assign it to something at any point in your game and if its still being animated, it will animate the thing you assigned it to.
-BUT for this instance, as its animating over time and not a single frame calculation, the ordering of the two makes very little difference -
just going over this myself, it looks like your main issue though is your setting the wrong property, instead use the colour property and choose the a. from the list, the alpha is controlled in the colour tint rather than that alpha setting
-
Yeah, i figured it out. Thank you very much for your time and explanation, helped a lot! :)
I just want to mention that i get some drastic FrameRateDrops on the PC; i use for example two of such FSM, which fade two objects out/in (i made them for the moment infinite, so the fade out and after 2 seconds the fade back in)
In a Script i attached to my camera i made a line:
"Application.targetFrameRate = 60;"
On my TargetDevice (iPhone4) the FrameRate is pretty constant, it stays between 58-60 FPS, but on the PC it goes from 60 down to 20. If i disable the FSM and play the game, the FPS are at least back at 50.
-
Allrighty, i'm learning more about this but for some reason i cannot find the right value with the get-property action.
what i'm trying to do is gain access to the "OnHover" boolean value that's apparently available to be extracted from a button. Any help would be much appreciated.
-
@ mayhem, PC speed should be running a lot faster than your mobile device, if your PC is running slower FPS than a mobile device your issue could possibly be with your PC specs
for example on my android phone (xperia s) my game runs at 30 fps, on my PC in editor runs at 400 FPS, as a standalone exe it runs at 1000 FPS
@ Red, the onhover is gotten from the NGUItoPM script on the first page of this thread
attach it to the button and when you go on hover, it will send an event, the event by default is OnHover but you can change it in the scripts properties to send what ever event you like.
-
@ mayhem, PC speed should be running a lot faster than your mobile device, if your PC is running slower FPS than a mobile device your issue could possibly be with your PC specs
for example on my android phone (xperia s) my game runs at 30 fps, on my PC in editor runs at 400 FPS, as a standalone exe it runs at 1000 FPS
@ Red, the onhover is gotten from the NGUItoPM script on the first page of this thread
attach it to the button and when you go on hover, it will send an event, the event by default is OnHover but you can change it in the scripts properties to send what ever event you like.
I'm not seeking the events, that works just fine... what i need for my system is a way to detect when the button is and is not having the mouse over it. using the event script only sends events as far as i can tell looking at the code... what i need is the actual boolean value that NGUI uses to indicate that it's hovering or if it's not hovering (i guess there are other ones too but i haven't looked into those scripts.)
so, it's not the event, it's the bool(s) that i'm after.
-
I understand what you mean but I am nos sure if there is a difference.
a get property must be always running to get the bool value as soon as it changes, meaning that you will have to either have strategically placed fsm's to get the bools property when you need it, or a generic fsm that updates every frame.
and then depending on the bool value to do something. (e.g. if not hovering do nothing - if hovering do something)
meaning that instead of a get property and a bool test every frame you can just have an event out of your state that is then fired at the same locations as above (even if its to to a state to turn a bool to true to use else where) using the UIevents to PM script
as I have never used on hover (cant onhover a touch on a screen...) I am only guessing that the onhover is fired a second time when un-hovering, in which case use a bool flip on the event that is fired from the UIevent to PM
-
No, that's the thing... I don't need to have an action detect when it's hovering per-se, i need to know when it's not hovering.
The problem i'm trying to address is that the weapons are firing their actions even when the player is trying to access the menu. I've tried it with a raycast from the screen to detect when it's over a GUI layer item but that doesn't work with NGui (or regular Unity GUI stuff)
the only work-around i've come up against would be to hard-code an area of the screen as being off-limits but that doesn't take into account dynamic menu stuff which is kinda what i'm aiming for.
not to mention the systems are abhorrently difficult to make sense of... so, for a corner area, i'd have to set up a mouse screen system that extracts the values of the mouse, compare each value independantly and if it's greater/lower than a certain amount, then fire off the appropriate actions... this is really only useable for a "one side" approach and the system becomes nightmarishly convoluted to set up a small X by Y rectangle in the corner since i have to use multiple FSMs to even filter that... So, if you want to get technical, yes, i am fully intending on having a "get property every frame" action and threading it into another FSM that manages these states since that has a much lower overhead than the whole screen-space juggling act. And the biggest weakness for this? it only works with a set resolution since the X and Y values are going to be different (unless it's in the bottom-left corner only) whether it's normalized or not.
So, if there were a way to extract from these the state of the onHover, onClick, onTooltip, etc... then i can use that...
so, to reiterate, i don't need to know when "onHover" fires, i need to know when it turns off. the system as is doesn't seem to want to allow me to gain access to that information and from the NGui people, it's apparently just a boolean value that ngui threads to the various scripts... and i can easily work with boolean values no-problem (and it makes it a very simple FSM system to set up and maintain since it's just a few actions that are running every frame so CPU power isn't consumed as much as the only workaround i've managed to find to address this issue.)
-
have it set to always off?
and then when it is on, set it to on?
for example, I am guessing your weapon fire is controlled by FSM? so in its idle state (not firing) have a event called OnHover
when its in its firing state also have another event called OnHover.
and then send these events to an action that flips a bool to determine if the mouse is hovering over UI
from this bool flip have a bool test to see if you was previously in an idle state or firing state.
set the firing state bool at the beginning of the idle or firing actions
-
Tried that. On the surface it does look like it is working but put that on a smaller button where the mouse could go over it faster than the FSM can calculate the action and it'll reverse the value of the boolean that's being used to store the "hovering" state.
If you're developing for mobile, chances are this will fit the bill since you have a set framework and a smaller range of CPU power/latency... but for a PC deployed action game with a deployment across a very broad range of CPU power, i cannot afford to have that level of unpredictability since that bug (and it is a bug) could ruin the gameplay for some of my players and it'd be more noticeable on lower-end computers. so, if the toggle gets flipped and doesn't flip back properly, their entire weapon systems will be disabled with this method and that would lead to an infuriatingly-negative customer experience.
Found more ways it could break too... Since it's using a flip instead of a manual set, if this is using buttons within a screen that has this feature (so, say a screen is open with a character sheet and it also has a selection of buttons... the bool is already supposed to be "disable weapons" but when it rolls over another button in this character screen it could toggle it as well. I do understand you can change these things but from a design perspective, it's not a very good workaround since my menu screens are designed in such a way as to give the player the option to do some menu actions on the fly and some while paused. setting up a system to detect and disable/enable as needed is a potential workaround but that is a lot more work to try and get around not being able to view and use a simple boolean value.
Simple boolean value? no workaround, you just use it.
complex and convoluted workaround? too many options where bugs can occour and it's an awful lot of wiring just to get around not being able to access a simple value.
So, i guess i'd like to put in a request for either an action set or an adjustment to the first script (or both?) so as to be able to find and read these values. Also, being able to access these values more directly will allow more options for useability and less headached with workarounds.
-
You know, thinking back on it, i feel i owe you an apology, Sjones.
Looking back on it, the system you recommended does work (albeit it has potential for issues which places it on my "maybe use but refine if future updates to system allow more direct control" list) and i feel calling it an outright bug was uncalled for and a bit extreme.
That doesn't mean i'm not hoping for a refining of the NGui integration so as to give the users direct access to the states themselves as a boolean value, but in the end i feel that my words were harsher than i initially intended them to be. Please accept my apology as you did not deserve such harshness.
-
dont worry, I understand where you are coming from, I have similar issues with unity, things that should be easy are not and things that should work dont work the way you expect and have to find fixes.
unfortunately there is nothing else I can suggest apart from going through the ngui code to find out what their bool code is exactly.
-
Is there a way to access certain Classmethods which aren't components on an object like the NGUITool functions?
Being specific i want to access the NGUITool.AddChild-function, because ArenMook (developer of NGUI) always persists to use this function in order to instantiate Widget-Prefabs and not the Unity-Instantiate-Method.
-
Hi,
For this, specificy custom actions will be necessary. I am about to seriously get into porting nGui, so I will port this nGuitool set as well, it holds some very cool functions and helpers.
Bye,
Jean
-
Just started using Ngui for creating my HUD with health bars, this works great with playmaker Set Properties and Ngui progress bars, but they update every frame and you can see the jump from say 51 to 52 to 53 etc.
Is there a way to smooth this out with Itween? ive tried a couple way but can get it to smooth out.
-
Hi,
yes, but don't use tweening. Tween engine are not good when the target is changing values.
You need to add one layer of indirection. Store your health in a fsm float ( instead of int), us it as a target, and play catch up with the current health variable ( the one you inject on your hud), and use an action such as "float lerp"
http://hutonggames.com/playmakerforum/index.php?topic=2905.msg13336#msg13336
bye,
Jean
-
This is my current setup for player health updating NGUI, how to i use the float lerp with this?
-
Thank you so much, I have been stucked here for a couples of days unitill I find this, I don't know what to say, love you :-* :-* :-* :-* :-*
-
Hi,
ok, here is a ngui health bar with smoothing, simply adjust the health property in the fsm inspector and you'll see the ngui slider move smoothly to catch up with the health value.
Enjoy :)
Jean
-
Hi there!
I was wondering what would be the process of getting the OnSubmit event from an nGUI Input Field.
When the user types in the string, pressing ENTER by default sends and event called OnSubmit.
The component you provided didn't have the OnSubmit field, so I tried adding it myself.
I've added another field in the main class setup:
public string OnSubmitEvent = "OnSubmit";
and then added another function:
void OnSubmit(string show)
{
if (!enabled || targetFSM == null) return;
Fsm.EventData.StringData = show;
targetFSM.SendEvent(OnSubmitEvent);
}
and this seems to fire the event in the FSM.
So, being nowhere near a programmer, I want to know if what I did is ok.
Thanks,
Petar.
-
Hi,
perfect! you acquired the most important skill for programming: clever copy/paste! I am not joking, I think I simply never actually start anything from scratch, it's always been done before somehow, so copy pasting code is very important, and when done right, you get new features :)
bye,
Jean
-
Hi,
Started a wiki page that will feature all the Ngui work to work with it from PlayMaker.
The first script is an extension of this UI event forwarder that features the ability to receiver slider change callback.
https://hutonggames.fogbugz.com/default.asp?W1111
bye,
Jean
-
Hello! I've been using UIEventsToPlaymakerFSM, generally to great success. However, I can't seem to get the "On Drop" action to fire. I opened up the script and it doesn't look like an OnDrop function is referenced at all.. however I am not a programmer so I would be grateful if someone with more coding knowledge could take a look at this for me?
Thank you!
-
Hi,
Good catch :) sorry about that, It's now implemented correctly, you can redownload here;
https://hutonggames.fogbugz.com/default.asp?W1111
Bye,
Jean
-
Hi Jean,
I am still unable to get the "drop" action to work (though the new debugging messages are hugely helpful!) Unless I'm missing something? Should the action fire when I drop it anywhere, or does it need to be dropped over something specific?
Thanks for helping me figure this out,
Jenna
EDIT: Ok, just realized that the "UIDrag Object" script that I'm using doesn't have the OnDrop function within it, which would explain why it's not firing! I'm going to dig into this a bit and see if I can figure out the best way to do this.
-
Hi,
Yes, I tested and it work. You need to explicitly define the "event receiver" in the nGui component that will fire the drop event, in most case the gameObject itself.
bye,
Jean
-
Hi.
Do you know where I can find a demo on how I can use "ui popup list" of ngui ?
Thanks !
-
Hi,
You can find a demo in nGui package itself, it's in "NGUI/examples/Scenes/TUtorial 11"
and for that matter, I have updated the playmaker port so that you can get the OnSelectionChange Event.
Simply download the new version or NGuiEventsToPlaymakerFsmEvents.cs on the wiki:
https://hutonggames.fogbugz.com/default.asp?W1111
drag that on the gameObject "SlicedSprite - Rectangle" ( because the pop uplist has set it's receiver to that object), then add a Fsm on "SlicedSprite - Rectangle" too, with an event "NGUI / ON SELECTION CHANGE", and you will be getting the selection ( in the event data as a string.
Bye,
Jean
-
My brain has been frozen ! :D Can you upload a demo scene ?
I would like to thank you in advance
-
Hi,
ok, I have done quite a bit of rework on the NGUI bridge, I have attached a complete Package.
In there, you will find a "examples" folder, and the scene "Tutorial 11 PlayMaker", it's the popup list examples, with playmaker bridges setup.
Can you tell me if you find it easier like that?
-- ALL ngui playmaker events are now globals and hosted in "NGUI PlayMaker Proxy" prefab, so put that in your scene and you will not have to manually create these events
-- the event bridge between NGUI and PlayMaker has now a very advanced Custom Inspector
-- if there is no fsm, it will let you create one with a button
-- if it finds a fsm on that gameObject or if you target a specific fsm, it will then look up if ngui events are implemented or not.
-- during the playback it will also give you stats on usage for each of these ngui events, so that you can quickly know what's going on.
Also, study carefully the different Fsm, especiall the one attached to the gameObject "Popup List" and the one attached to the gameObject "SlicedSprite - Rectangle", it's very important that you grasp the way NGUI works with these events, in our case, Popup list targets "slicedSprite -Rectangle" so you can only received "NGUI / ON SELECTION CHANGE" on that gameObject, so the "NGuiEventsToPlaymakerFsmEvents" MUST BE on that GameObject. You can however redirect to any Fsm of course.
I am thinking of working on another aspect of this bridge, cause I still don't like the fact that it's within NGUI that you set up the link, I would like to find a way so that within the "NGuiEventsToPlaymakerFsmEvents", you define what NGUI component to listen too, that will lift another possible area of misunderstanding and frustration if it's not properly understood.
I need to do some more clean up, and I will release this on the wiki.
bye
Jean
-
Jean,
I hope you find a way I like your thinking and I believe your way will reduce unwanted use of resources. :)
-
Hi,
Thanks :)
It's not so much resources, but more workflow related here, linking from ngui to playmaker or the opposite is the same under the hood, it's just less obvious for beginners, and generally less convenient.
bye,
Jean
-
Is it possible to find a video tutorial of popup list ?
Its a bit hard to understand how you do it
Best Regards
-
Yes, I tested and it work. You need to explicitly define the "event receiver" in the nGui component that will fire the drop event, in most case the gameObject itself.
Hi, I'm trying to get an a simple Drag&Drop action happening with my UI, but I can't get the OnDrop event to fire.
What I am trying to achieve: click and drag an icon from the UI onto an object in 3D space in the scene, and fire an event on that object.
I have a UIDragObject script on the object I wish to drag, and a Playmaker FSM on the object I wish to drop it on. This FSM contains only two states, with an OnDrop event that, as I understand it, should trigger once and OnDrop event is fired while the mouse is over it.
Both objects have the NGui Events to Playmaker Fsm Events script with the Target FSM variable set to their respective FSMs.
The Drag works exactly as expected, however when I perform the drop nothing happens.
The Debug log shows OnDrag updating position while dragging and OnPress returning to False when the mouse is released, but I am not seeing any OnDrop debug lines.
What am I missing? I Do not quite understand the post quoted above either. Which is the component that will fire the event? The Object I originally clicked on or the Object I'm dropping on to? Furthermore where is the "event receiver" and which of the two objects am I setting it to?
Sorry if this post is a little long, I am rather confused :)
-
Hi,
It's actually very straightforward.
1: open the ngui example11 scene
2: select the gameObject 3D/Stage/DragDropSurface
3: add the component "NGuiEventsToPlaymakerFsmEvents" to it
4: add a Fsm component to DragDropSurface as well
5: in the fsm, add a state with a global transition "NGUI / ON DROP" ( all ngui events are available in the transition menu under "global events"
6: double check that in the NGuiEventsToPlaymakerFsmEvents, the Drop entry turned green, this means, we have detected that you are actually implement the "NGUI / ON DROP" event.
7: run the scene, drop something onto the cube, and the fsm will receive the drop event.
Now, if you ae building a scene from scratch, it could simply be that you don't set up ngui properly to being with.
-- also, you may think that the gameobject you have adde the component NGuiEventsToPlaymakerFsmEvents received drop events, but actually doesn't, that's something you will need to verify outside playmaker environment, like dropping a simply script that listen to drop events ( very much like "DragDropSurface" script provided in the example 11 scene.
hope this helps, else get back to me, I'll have a look at your project.
bye,
Jean
-
Ok.. I am trying to fix the project after accidentally deleting the global vars file... tedious. Now I am trying the new Ngui-playmaker stuff and I must say I would rather prefer the old method where you could write your own "event name".
My problem is I have two buttons, Ok and Cancel. With the new way of doing it, I only get "onClick" event fired. So both buttons fire the same event. not cool if I need one button to fire a cancel event...
I wonder if the old way is still available.. I don´t know the name of the script..
/s
-
From the wiki:
"Put this component on the GameObject with the Collider used by NGUI. Choose an FSM to send events to (leave blank to target an FSM on the same GameObject). You can rename the events to match descriptive event names in your FSM. E.g., "OK Button Pressed" NOTE: Use the Get Event Info action in PlayMaker to get event arguments. See also: http://www.tasharen.com/?page_id=160"
How do I rename the events? In the old UItoPlaymaker I got a list of events that I could rename, now I only got this:
(https://dl.dropboxusercontent.com/u/957197/WebShare/nguitrouble.jpg)
Maybe there is an installation problem?
Getting frustrated here.. all my work just falls apart, because of new versions of NGUI and PM destroyed my game.. stuff just stopped working that worked perfectly before. Probably operator malfunction...:(
-
can we get MOUSE EXIT function?
nevermind, i got it working with on hover, and then adding second on hover to hide it
-
Thanks jeanfabre, I got it working in the example scene following those steps, however I still can't make it work in my custom scene.
The scene is very simple. Basically I have a player inventory, and I want to be able to drag icons from the inventory over objects in the world, the have that trigger some event on the object.
I assume I need the following:
UI Button:
> a drag/drop script of some description, that stores a reference to the icon image that will be dragged (currently a child of the button).
world object:
> an FSM with a NGUI / ON DROP event set to trigger
> an NGuiEventsToPlaymakerFsmEvents component
> a script of some description that identifies the object as a valid drop target
I had tried various combinations of scripts that ship with NGUI but I've been unable to get further than dragging an icon around using UIDragObject.
I have tried attaching a simple script to the world object (based on DragDropSurface) to test if it was receiving OnDrop messages:
public class DropSurface : MonoBehaviour
{
void OnDrop(GameObject dragObject)
{
Debug.Log("OnDrop worked!");
}
}
But nothing happens.
Does the UIDragObject script need to send an OnDrop message somewhere?
I have very little programming knowledge (I'm trying to teach myself while working on this project), so pre-built solutions like NGUI and Playmaker have been great. I just have trouble when I need to delve into the scripts themselves :)
-
What difference a lunch-break makes. After browsing through some documentation I noticed this line: "You can add the following functions to your scripts placed on widgets or in-game objects with a collider, provided they are drawn with a camera that has the UICamera script attached"
I attached the UICamera script to my main camera (since the gui camera is set to draw only the UI) and now it all works.
However, not I have UICamera on both the gui camera and the main camera. Is this likely to cause issues?
-
Hi,
not sure, hopefully someone can step in to comment on this.
bye,
Jean
-
can we get MOUSE EXIT function?
Hi,
Just to comment on this: MOUSE EXIT is actually dealt with ON HOVER, it has a boolean flag which tells if hover enters or exit, that's how you do it in NGUI.
http://www.tasharen.com/?page_id=160
bye,
Jean
-
Hi !
I'm new in Playmaker and nGUI and i've got a simple problem that i cannot get rid of...
How do i make my nGUI elements appear and disappear with a Playmaker action ? (like when a main menu disappear, to make appear a level menu)
I've tried to Set the "Enable" Property of the GUI Component, it hides it, but the player can click on it as it was shown...
I've tried to Set the "Active" Property of the GameObject, but once it was unactived, no way to turn it back to "active", even with another GO setting the property...
I know it may be a stupid question but i really can't find a way :/
-
Hi,
I think you need to hide the panel, you will get better results, as the button component is only the visual thing, the collider remains active. So either deactivate the whole gameObject, or it's parent panel.
bye,
Jean
-
Okay Thanks for the quick reply ;)
-
Hi, great Addon but I have a few problems.
On a new project using the latest version of Unity, I get three warnings;
---
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(31,92): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'
---
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(40,75): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'
---
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(50,75): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'
---
Also, because I am not using Photon, if I remove the PUN folder after importing Playmaker I get the following error:
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(103,50): error CS0103: The name `PlayMakerPhotonEditorUtility' does not exist in the current context
---
Obviously I can just comment this line out but I am just making sure that doing so will not break anything within the scripts and gameObject that is in this new version of the Playmaker-NGUI addon.
:)
Many thanks,
-Andos.
-----
EDIT:
How strange.. after I closed Unity and came back to it the warnings have gone.
EDIT:
Nope, scrap that - it still shows the warnings. Will this be updated soon so that these warnings will vanish?
-
Hey all,
Ok i asked this in the Help section but I guess it is more tailored to NGUI so I'll try here.
Is their anyway, other then using get/set properties, to change the 'Color Tint' of a sprite/texture in a button (say you wanted it to be gray if not allowed to click but if for some reason you are allowed to click it, it is white)?
I have tried using SendMessage but not sure what to send, i have tried set_color but what ever I put in 'Texture' (which of course I am trying to put a color) just gets reset to none or default color of white when I return back if i've run the project to test it.
Any ideas ;-)
UPDATE:
I decided to go down a different route, I just added another sprite/texture to the button and deactivated it. Then in my FSM, when I needed to, I (de)activated the relevent sprites.
Cheers all,
-Andos
-
I use a "set property" action to do this. But remember you have to "drag" the NGUI item to the object slot, not the whole gameobject. Then you select "color" in the dropdown menu.
Hope this makes sense to you, as I am not able to reference the correct Unity terms for this, as I am on a mobile device.
-
I get a error message if I start the NGUI Playmaker Example
I don't know what is my mistake
Edit:
Ok my fault. I have re download Playmaker and now it works :)
-
Hmm, late night brain bubbling here on the whole on hover to boolean thing... I was wondering... if this system is able to affect the events system, would it be possible that it can also read via actions?
it kinda hit me as i was mulling over this in that if there was an action that had a "get NGUI state" where you can either manually enter the name of the state in NGUI that you're looking for and you feed it a boolean to feed it to (with a toggle for every frame or only once) that could open up the flexibiltiy really fast.
Dunno... since i'm not a programmer i have no idea if this is possible and if so how hard it'd be (or maybe it'd be easy? dunno.) so, just a thought is all.
-
On a new project using the latest version of Unity, I get three warnings;
---
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(31,92): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'
Right before the last parenthesis on each line add the following:
"false,null".
Line 31 should look like this:
PlayMakerFSM _newTargetFSM = (PlayMakerFSM)EditorGUILayout.ObjectField("The Target defaults to",_targetFsm,typeof(PlayMakerFSM),false,null);
-
On a new project using the latest version of Unity, I get three warnings;
---
Assets/PlayMaker NGUI/Editor/NGuiEventsToPlaymakerFsmEventsInspector.cs(31,92): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'
Right before the last parenthesis on each line add the following:
"false,null".
Line 31 should look like this:
PlayMakerFSM _newTargetFSM = (PlayMakerFSM)EditorGUILayout.ObjectField("The Target defaults to",_targetFsm,typeof(PlayMakerFSM),false,null);
Many thanks, this worked.
-Andos
-
Humm... so now I am getting error:
Assets/PlayMaker NGUI/Widgets/UIJoystick.cs(133,45): error CS1061: Type `UnityEngine.Vector3' does not contain a definition for `AlmostEquals' and no extension method `AlmostEquals' of type `UnityEngine.Vector3' could be found (are you missing a using directive or an assembly reference?)
after just reimporting PlayMaker NGUI (i just re downloaded it too)
cheers,
-andos
-
Hi,
I see, I relied on photon being there, You've removed the photon folder right?. Simply delete that script if you don't need this. I'll correct this for the next update on this package.
bye,
Jean
-
I don't know if you guys know about this, but I think it should be mentioned:
http://forum.unity3d.com/threads/192544-PlayMaker-NGUI-Scripts
It's nice that someone took the time to cover a lot of functions, but I don't know exactly what I should think about the 15$ price-point...
-
Hi,
yes. It seems a very good asset. As far as the price entry point. It's up to every one to judge this. As far as I am concern, It's always a matter of how much time you are going to loose trying to do this against how much time you are going to save using an asset that answer your needs.
So, $15 is like nothing in your working day, and doing all the things you need will cost you a lot more than $15 of your time.
There is also reviews. so I would really encourage you to get it if you see int here a value for your project and needs ( not affiliated in any way with merlin981). If you find issues, simply contact him, make requests. I am pretty sure he will be more than willing to listen and answer your questions, and probably take your requests in account to improve/expand.
also $15 is hardly a one stop to the mcDrive... :P
bye,
Jean
-
Oh no, don't get me wrong. I have absolutely NO problem buying assets, scripts etc. I mean, I'm developing games and would like to see that people buy the game my team spent so many hours, days, weeks, months in order to complete it. I respect the work and effort of the creator of the NGUI Scripts.
The only thing that bothers me a little bit:
- here in the forums the Users help out each other, sharing new Actions for certain scenarios or certain new Plugins. For free!
- this topic here for example: You, jean, and other people are helping each other to control NGUI via PlayMaker. For free!
Don't know what to think about it. It's kind of weird that a lot of other actions for other plugins made by users here are for free and for NGUI you have to pay.
As said before, I have no problem with paying a person who did a good job. It's just about the principle.
I'm just asking myself: Since there are now NGUI-Actions. Is this topic still relevant?
For now I'm in no need for the Actions the guy made, because "Get/Set Property", "Send Message" and "Invoke Behaviour" are doing well.
-
Hmm... I'm tempted to give it a go but looking at the documentation it seems that the get/set property would be a logical answer to about half of those features. Sure, i'm going to guess that they're made much more easy to use and specific but the get/set property actions are actually pretty potent in their own right (though they have their limits, it's not impossible to work around them.)
EDIT: All that said, I'm not trying to be critical of the pack... and neither am i saying this to suggest that these kinds of features should be integrated into Playmaker... more that there are many ways to get done what you need to get done.
-
Humm... so now I am getting error:
Assets/PlayMaker NGUI/Widgets/UIJoystick.cs(133,45): error CS1061: Type `UnityEngine.Vector3' does not contain a definition for `AlmostEquals' and no extension method `AlmostEquals' of type `UnityEngine.Vector3' could be found (are you missing a using directive or an assembly reference?)
after just reimporting PlayMaker NGUI (i just re downloaded it too)
cheers,
-andos
I'm seeing the same error here. Does anyone have a suggestion on this? This is the latest version of Unity (4.2), Playmaker, and Playmaker NGUI . Brand new project.
-
As of this writing it seems that importing PlayMakerNgui or PlayMakerNguiExamples into a project will pretty much destroy the entire project. Neither NGUI nor PlayMaker will load w/ either installed and MonoDevelop just crashes.
"Assets/PlayMaker NGUI/Widgets/UIJoystick.cs(133,45): error CS1061: Type `UnityEngine.Vector3' does not contain a definition for `AlmostEquals' and no extension method `AlmostEquals' of type `UnityEngine.Vector3' could be found (are you missing a using directive or an assembly reference?)"
-
Hi,
It's because you need Photon. Simply delete UIJoystick.cs file from the assets.
Bye,
Jean
-
Hey there! I want to say thank you for this... even though I kinda had a bit of a melt-down in this thread earlier, I can't deny that you've been really putting things together and for that I should say thank you.
Though, I'm not sure if this is do-able but for the monitoring script that was made for this system... is it possible to have it allow for multiple FSMs being in the slot? Not that adding another on there for multiple FSMs is a bad idea (that I know of) but for an ease-of-use thing, if it's possible, i'd like to suggest a means to do so.
-
Hi,
Don't worry. I know how stressful and frustrating things can be at time. So never give up!
Good idea for the multiple target. I'll see what I can do.
Bye,
Jean
-
Do you guys now if the UIEventsToPlayMakerFSM-Action works with the latest 3.X NGUI Update?
-
Hi,
I have planned to work on this this week. I think it should work, but I haven't testes that system yet. Currently, I don't recommand tho that you switch to ngui 3.x if you are using playmaker and ngui custom actions.
bye,
Jean
-
I tried it already by myself. UIEventsToPlayMaker works fine.
Which custom NGUI Actions do you mean?
I only use the UIEventsToPlayMaker-Script and a bunch of PlayMaker-Actions like "Get/Set Property", "Invoke Behaviour" or "Call Method". Worked great so far and I don't see any reason why these actions shouldn't work with 3.X :)
-
Which custom NGUI Actions do you mean?
Regarding NGUI 3.0:
Just imported the NGUI addon free, which i suspect is this thread about? https://hutonggames.fogbugz.com/default.asp?W1111 (https://hutonggames.fogbugz.com/default.asp?W1111)
I got several compiler errors, which seem to-be fixable. UIButtonTween is replaced by "UIPlayTween", the broken Vector3 comparison can be replaced by a distance check and a color was taken from a other package that can be simply hardcoded.
Ofc would be nice to get a updated 3.0 compatible package.
The main functionality i seek is putting our HUD into a playmaker state-machine for better control and NGUI tweening functionality from playmaker.
bye Andy
-
Hi,
just found a bug in the "NguiPlayTween.cs" component.
The "resetOnPlay" needs to happen before the actual play/toggle() is called. In the current version this happens directly after the play.
public void PlayTweeners()
{
...
if (resetOnPlay.Value) {
tw.Reset();
}
// Toggle or activate the tween component
if (playDirection == Direction.Toggle) {
tw.Toggle();
}
else {
tw.Play(forward);
}
...
}
bye Andy
-
Hi,
NGui 3.05 is not supported, you can grab the package on the wiki as usual:
https://hutonggames.fogbugz.com/default.asp?W1111
@Andy22: sorry I completly missed your post on this resetOnPlay issue, I'll address this asap.
bye,
Jean
-
@Andy22: sorry I completly missed your post on this resetOnPlay issue, I'll address this asap.
Seems its still missing from the 3.05 compatible release, also there is a small change in 3.0.7 f2. Seems "Reset()" is now private and "ResetToBeginning()" should be used. We still want to reset before we actually do the play or toggle.
public void PlayTweeners()
{
...
if (resetOnPlay.Value) {
tw.ResetToBeginning();
}
// Toggle or activate the tween component
if (playDirection == Direction.Toggle) {
tw.Toggle();
}
else {
tw.Play(forward);
}
....
}
bye Andy
-
Hi,
that will teach me not writing it down... Sorry about that.
It's now properly recored:
https://trello.com/c/c5lhe9hh/30-ngui-3-07
bye,
Jean.
-
Hi,
Done, yuo can updated from the wiki. Can you double check it works as expected? thanks :)
Bye,
Jean
-
Hi,
Done, yuo can updated from the wiki. Can you double check it works as expected? thanks :)
Bye,
Jean
Yep works and thx for spotting/moving it just into the Play() part and the Toggle logic.
bye Andy
-
YES! why haven't i found this sooner.
Spend so many hours troubleshooting scripts for toggle and sliders
if i knew i could use playMaker for this.. damn.. <3 <3
Awesome work
-
I think I'm going to need some help with this new version. I've been working with the UIEventsToPlaymakerFSM script for a long time. It was quite simple to use. I just upgraded a project to NGUI 3.x, and imported the new Playmaker->NGUI tools Jean created, but there's so much more here that I'm a bit confused.
What I want to do is mimic the functionality of the old UIEvents script, to receive events when a button is clicked on and use that to change states in my FSM.
In the past I would create a custom global event that corresponded to the button I needed, such as OnClickSettings. This new version seems to suggest I need to use these pre-made global events such as NGUI / ON CLICK for my FSM, however I'm not certain how the script determines which button was clicked in a GUI with multiple buttons.
Am I just misunderstanding the functionality of this? Or is there something else like a specific action I can use to get which button was clicked and then change states appropriately (which seems like more work)?
As always, thanks in advance.
-
Hi,
the UIEventsToPlaymakerFSM only works for the gameobject it is attached too, so it can't mix up ngui calls, UNLESS several UIEventsToPlaymakerFSM targets the same Fsm, which is something that is ok still, but definitly blurring the situation, prefer one fsm per UIEventsToPlaymakerFSM on the same gameobject, then you dispatch further to other fsm. then you won't get mixed up, I always do that.
bye,
Jean
-
Ooof... Man, this changes everything about how I've structured all my projects.
Before I could have my menu structure contained cleanly in a single manager gameobject, and send UI events from anywhere. Now I basically have to turn everything into a relay-structure, is that right?
Thanks for taking the time to reply.
-
Hi,
Yeah, I guess so, I don't see this as "less clean", I actually would advocate that it will amke things a lot easier in the long term, more manageable, more granular, more controllable for fine tuning. ( like making a more complex sub widget for a given part of your UI, if you have a big manager for everything, then you are doom to refactor most of it, here if everything is local, higher parts won't be affected At all by su changes.
bye,
Jean
-
Hopefully this is the right place for my question. I am having an extremely difficult time getting OnSubmit to work from the Ngui events to Playmaker events. I have had no problem with all the other functions but I just can't seem to get an input field firing.
What I've done is created a simple input field from the ngui prefabs. I attached an fsm, Ive attached Ngui Events to Playmaker Events, I've attached Ngui events forwarder, and also applied the forwarder to On Submit Notify. I then created a state with Ngui>On Submit transition (I tried a global one as well) Is this incorrect? Clearly I am missing something. I can't find much other information on it.
-
Hi,
UIInput actually use the ngui click event if you press the "enter" key. Can you double check on your end you have this as well?
bye,
Jean
-
Hi,
New version to support 3.5.6 verison of ngui, with OnSubmit implemented and verifired ( sample available as well).
https://hutonggames.fogbugz.com/default.asp?W1111
Bye,
Jean
-
Hi I'm trying to figure out if I can use the onChange event from an Ngui UIInput. I understand how to get the onSubmit event working, but I really need to have an FSM act without waiting for an enter key or leaving the field.
Any ideas, or is this being looked at?
Thanks
-
Hi,
ok, please updated from the wiki, I added a new event "NGUI / ON CHANGE" which will work for UIInput as well as UIToggle.
Bye,
Jean
-
Hi
Does this add-on work with latest versions? I have 3.7.7 and i got this error when i try to add script:
"Can't add script
Can't add component
'NGuiEventsToPlaymakerFsmEvents' because it doesn't exist. Check to see if the file name and class name match"
I already have 'NGUI PlayMaker Proxy' prefab added to the scene
-
Hi,
I have just tested, and it works fine. I guess you are missing the ngui playmaker package it seems.
do you have other errors?
what version of Unity are you using?
Bye,
Jean
-
Hey this is great, how do I do a simple 'on NGUI Button Click' action?
Or is it named something differently but is already there.
-
Hi,
currently, I don't think there is such action, you'll have to use the NGuiEventsToPlaymakerFsmEvents component to bind a button click to an fsm event.
Bye,
Jean
-
Hi,
ok, please updated from the wiki, I added a new event "NGUI / ON CHANGE" which will work for UIInput as well as UIToggle.
Bye,
Jean
I can't find that in the actions...
-
Hi,
It's not an action, it's a component you need to add the ngui GameObject, then you'll get to set it up to fire that CHANGE event.
Bye,
Jean