Unity3D for iOS: UIToolkit Not Compatible with iTween

UITookit is pretty cool, it’s FREE and it improves performance on mobile devices. However, one thing to be aware of is that UIToolkit doesn’t play nice with iTween. There are some potential hacks mentioned on the forums but those don’t sound pretty & there doesn’t seem to be any examples/source code available for those hacks.

iTween requires an instance of GameObject as it’s animation target. Trying to tween a UITextInstance or casting it to a GameObject doesn’t work:

var textToolkit:UIToolkit;
var textToolkit2:UIToolkit;
var buttonToolkit:UIToolkit;
var txt1:UITextInstance;
var txt2:UITextInstance;


iTween.MoveBy(txt1, iTween.Hash("y", y, "easeType", "easeInOutExpo", "delay", .1));	
			Assets/Scripts/mainMenuScript.js(54,22): BCE0023: No appropriate version of 'iTween.MoveBy' for the argument list '(UITextInstance, System.Collections.Hashtable)' was found.

iTween.MoveBy( txt1 as GameObject, iTween.Hash("y", y, "easeType", "easeInOutExpo", "delay", .1));	
			NullReferenceException: Object reference not set to an instance of an object
			iTween.Launch (UnityEngine.GameObject target, System.Collections.Hashtable args) (at Assets/Plugins/iTween.cs:6740)
			iTween.MoveBy (UnityEngine.GameObject target, System.Collections.Hashtable args) (at Assets/Plugins/iTween.cs:1832)
			mainMenuScript.Start () (at Assets/Scripts/mainMenuScript.js:54)

UIToolkit has it’s own basic animation engine but it doesn’t support Robert Penner’s open source easing equations out of the box. Looks like it’s partially possible to manually add some of those to the code but not all.

Haven’t yet tried this:

Make the UI / UIToolkit objects children of a GameObject in the Hierarchy. Then try to animate the GameObject & see if it’s children follow.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s