Unity3D for iOS: Tweening the Alpha on UIToolkit’s UIProgressBar – Border Fades, Bar Remains

Had to use UIToolkit’s UIProgressBar component today and ran into an issue. After the progress bar was done, I called an alphaTo() method on my “var progressBar:UIProgressBar” to fade it out. The border graphic faded out as expected but the actual progress bar stayed on screen.

As a quick workaround, the following worked for me:

  1. Added a Getter method called theBar() for the “private _bar:UISprite” variable in the UIProgressBar class.
  2. Added a second alphaTo() call to my code, using “progressBar.theBar” as the animation target
using UnityEngine;
using System;

public class UIProgressBar : UISprite
	public UISprite theBar
		get { return _bar; } 


function Start()
	progressBar = UIProgressBar.create( "loadBar2x.png", "loadBarBorder2x.png", 6, 7, 0, 0);
	progressBar.positionFromBottomLeft( .1f, .3f );
	progressBar.resizeTextureOnChange = true;
	progressBar.zIndex = 0;
	progressBar.value = 0.4f;
	progressBar.alphaTo( 1.5f, 0.0f, Easing.Linear.easeOut ); 			
	progressBar.theBar.alphaTo( 1.5f, 0.0f, Easing.Linear.easeOut ); 	

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s