Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Mayhem on October 21, 2013, 03:47:28 PM
-
Hey there,
so I got this little problem. I have a UISprite (NGUI) GameObject which I want to tween with the HOTween-Actions. Especially the Alpha-Values of the UISprite. When I use the Visual Editor of HOTween everything works fine (tweening the Alpha-Property from 1 to 0), but as soon as I try to do it via States I got problems: it doesn't work.
My setup:
1. State: getting the Child of a certain GameObject and storing it into a local FSM-GameObject-Variable (that works, Inspector is showing the right GameObject)
2. State: Getting the right Component (UISprite) of the saved GameObject-Variable, stored in a local FSM-Object-Variable (Variable is set to UISprite in the Object-Dropdownmenu, this is working, too, shows the right component in the Inspector)
3. State: Getting the Alpha-Property of the saved Component, storing the Value in a local FSM-Float-Variable (does work, too! Inspector is showing the right Value!)
4. State: HOTween Float-Action
Start: alpha_value (float value where the alpha is stored)
End: 0
Result: result (other float value)
The rest are default-settings of the Action.
So now in the Inspector I can see how the Variable alpha_value is tweening from it's initial value 1 to 0 but the UISprite doesn't do anything. It's there like nothing happens, it doesn't become more transparent.
I both tried saving the Property as plain Alpha and Color.a value, didn't work.
(If I do the same with PlayByID and a setup Tween in the Editor it works.)
I also tried using Animate Float or Ease Float. Both didn't work.
What am I doing wrong? I need this one to be such a system and not called by ID!
-
Hi,
I looks to me that you don't apply the color properly, do you see the color in the ui component? is it the one you expect? if not, then your tweening and logic is not storing the float properly.
bye,
Jean
-
Yes, I see the Color in the UI Component:
(http://s7.directupload.net/images/user/131022/nwlodeow.png)
I tested it with a simpler approach:
When I set the Color.a value of the UIComponent directly, it works fine!
The UISprite Alpha-Value goes to transparent, I can't see it in the Scene and the Color-Tint from the UISprite Component int the Inspector shows an Alpha-Value of 0.
(http://s14.directupload.net/images/user/131022/2bq392za.png)
But when I use GetProperty and select the same Property (color.a) and store it in a local float (called "test") and use the Set Float Action to 0 it does not work.
(http://s14.directupload.net/images/user/131022/r4frzzin.png)
(http://s1.directupload.net/images/user/131022/tp87fqzk.png)
The variable "test" changes it's value from 1 to 0, but the color-property of the Component does not change. Not in the scene and not in the Inspector.
I thinkt that's the most basic approach on getting and setting variables, but it doesn't seem to work. I hope it's only my mistake and not a bug.
-
Hi,
Can you share that scene? What version of ngui are you using?
bye,
Jean
-
Unfortunately I can't share it, but I guess you can repro it very easy. Just look at the screens above.
Using the latest NGUI Version (3.0.2). I'm not using any NGUI Actions, just the normal PlayMaker Actions (set/get property, set float etc.)
-
Hi,
I am using this technic in many cases, that's why a simple repro would help find exactly what's different from the way I do it.
bye,
Jean
-
Well, I just tried it with the basic Sprite-Example-Scene from NGUI itself, which comes when you import NGUI to your project. Scene is called "Tutorial 2 - Sprite".
I attached a FSM to one of the three Sprites and did the exact same steps as described above.
Set Property worked.
Get Property -> stored Value in a float -> set float -> same result. Float was changed, but sprite is still visible.
-
Hi,
Simply send me that test scene you just did, and I'll have a look right now. I am currently working on NGui 3.x playmaker port, so I am all warmed up for it :)
Bye,
Jean
-
Allright, can you give me your mail :) ?
-
Just FYI, it didn't work with NGUI 2.7, too.
I already send you a PM with the link to the Project.
-
Any updates on this :) ?
Did you receive my PM?
-
Hi,
Yes, you need to repackage to include dependancies tho.
bye,
Jean
-
I don't understand, how do I do that?
-
Hi,
leave the "check for dependancie" on when packaging your prefab.
bye,
Jean