playMaker

Author Topic: Tweening a Variable?  (Read 6577 times)

Mayhem

  • Full Member
  • ***
  • Posts: 171
Tweening a Variable?
« 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!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #1 on: October 22, 2013, 02:31:39 AM »
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

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #2 on: October 22, 2013, 03:35:22 AM »
Yes, I see the Color in the UI Component:



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.


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.





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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #3 on: October 22, 2013, 05:33:08 AM »
Hi,

 Can you share that scene? What version of ngui are you using?

bye,

 Jean

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #4 on: October 22, 2013, 05:47:28 AM »
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.)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #5 on: October 22, 2013, 07:25:32 AM »
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

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #6 on: October 22, 2013, 07:34:07 AM »
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.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #7 on: October 22, 2013, 08:02:27 AM »
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

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #8 on: October 22, 2013, 08:08:53 AM »
Allright, can you give me your mail :) ?

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #9 on: October 22, 2013, 12:06:57 PM »
Just FYI, it didn't work with NGUI 2.7, too.

I already send you a PM with the link to the Project.

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #10 on: October 23, 2013, 06:04:31 AM »
Any updates on this :) ?
Did you receive my PM?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #11 on: October 23, 2013, 07:06:35 AM »
Hi,

 Yes, you need to repackage to include dependancies tho.

bye,

 Jean

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Tweening a Variable?
« Reply #12 on: October 23, 2013, 07:13:23 AM »
I don't understand, how do I do that?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tweening a Variable?
« Reply #13 on: October 23, 2013, 07:29:49 AM »
Hi,

 leave the "check for dependancie" on when packaging your prefab.

bye,

 Jean