Author Topic: TweenAlpha Issue : Texture still visible after disabling  (Read 2612 times)

Praivate

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
TweenAlpha Issue : Texture still visible after disabling
« on: February 05, 2014, 10:35:43 PM »
Hi !

I've encountered an issue with the TweenAlpha tool displayed by NGUI.

I have a TweenAlpha script attached to a Panel, with a Unlit/Transparent Colored shader. As a widget in this Panel I have a simple texture with a Unlit/Transparent Colored shader too.

The main idea is to have this texture fading in when the player goes under a certain amount of health, so I need to disable the Tween so it doesn't play at the start of the game, and to reactivate it later.

But when I disable the component by uncheking the box near the name of the script, the texture is still visible. The tween doesn't play anymore, so there's no fading in, but the texture is visible.

Is there something I don't understand with the utilisation of the TweenAlpha ? Maybe it doesn't work with a SimpleTexture widget ?

Praivate

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #1 on: February 06, 2014, 07:33:13 PM »
Does someone have an idea ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #2 on: February 06, 2014, 08:41:34 PM »
What does a panel have to do with a shader? Not sure what you mean there.

Disabling the tween won't do anything other than pause the transition. If you want to hide something, set its alpha to 0.

Praivate

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #3 on: February 10, 2014, 03:23:52 PM »
Indeed...

Thank you ! I guess I've worked too much on my project and didn't even thought of this u_u

Praivate

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #4 on: February 11, 2014, 11:57:39 PM »
Hey !

I have an other issue with Tween Alpha now :

I have a UIPanel with the tween alpha script on it, and a texture attached to it. I've set the alpha of this texture to 0 to hide it at the beginning of the game, and my tween alpha is disabled for the same reason.

Now, I need to trigger the tween with code when a specific condition is true. I've got that with .Play, but there's something strange and I can't get it work properly :
1) With the settings I described, nothing happen : the tween doesn't trigger at start, the texture is invisible, but it doesn't change either when the .Play instruction is read.
2) If I set the alpha of the texture to 1 and enable the tween, the tween plays on start but doesn't play when the instruction is read and the texture is always visible.
3) If I set the alpha of the texture to 1 and disable the tween, then the tween is played properly by the script but the texture is always visible too.

Can't I just have the texture not visible at start, the tween not played at start but then played when called from my script ?

I'm pretty sure I'm missing something obvious but I just can't see what. Do you guys have any idea of what I'm doing wrong ?

Praivate

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #5 on: February 12, 2014, 05:43:29 PM »
Any idea ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TweenAlpha Issue : Texture still visible after disabling
« Reply #6 on: February 13, 2014, 12:35:13 AM »
Likely related to one of the fixes in 3.5.0:
- FIX: Fixed an issue with how changing panel's alpha would not propagate to children in certain cases.

You can get around it by not attaching a tween. Use TweenAlpha.Begin(...) to start a tween on a target game object. The tween will be added for you.