LeanTween new UI Support

LeanTween new UI Support

Jan 15

Support for Unity’s new UI continues to improve in the latest LeanTween (more features, and more testing for stability). The latest LeanTween Editor features a new space themed ui skin that demos a lot of the LeanTween UI animation features.

The whole scene was done using only code generated from the editor (not having to write code can feel pretty liberating, great for prototypes or simple scenes). View the space ui scene running in WebGL (running with Unity5’s WebGL). A neat random fact, this runs on an iPad browser! (but only in Chrome, Safari runs for about 3 seconds before crashing)

Futuristic space skin is included in the editor update

Some exciting new additions to the LeanTween API are:

LeanTween.play (canvas sprite animations)
Animate the image ui item (UnityEngine.UI.Image) directly with LeanTween.
example: LeanTween.play(RectTransform rectTransform, Sprite[] sprites).setFrameRate(6f);

rotateAroundLocal (canvas)
Because sometimes you want to rotate the RectTransform in local space

The other ones that have been around for awhile: move, scale, rotateAround, alpha, color (all specifically targeting the new RectTransform object).


  1. Rex

    Please remove default parameters from LeanTween. They don’t work with MonoDevelop set to Target framework .NET 3.5, it always causes compile errors. They work in NET 4.0 but there is a known issue in Unity that if you set Monodevelop’s target framework to 4.0, it switches back to 3.5 everytime you reload the project and all the default parameter errors come back.

    I don’t know how you didn’t see this and released it like this, it’s amazing to me, it seems such a basic thing. Has been like this for months and it’s really annoying, it’s such a useless indulgence to use default parameters and you can easily fix it.

    Otherwise excellent plugin.

    • Hey Rex, Sorry I didn’t notice this. I don’t use Monodevelop actually which is how it slipped by me… I probably should, but I just find it very slow and clunky (I prefer just to use Sublime Text Editor). Is this all the functions that use the convention:

      seSomething(int something, object onUpdateParam = null )

      That break in MonoDevelop? Is there specific versions of Unity that this is a bug with?


      • Rex

        Hi Russel,

        The issue has been there at least for a few good months (now I am using Unity 4.6.3). It’s there if you use LeanTween with Unity out of the box. This is a shame because it might turn people off it.

        I work around it by manually editing LeanTween.cs to remove all default parameters with each update, however this might break things.

        (Here is more about the default parameters issue in MD/Unity:

        I’m sorry if I was a bit harsh in my first comment. The plugin is fantastic and I was getting a bit fustrated because i love it so much ๐Ÿ™‚ Thank you for the work and for making it available!

  2. Rabbit

    Can LeanTween tween between colors on a SpriteRenderer?

    If so, can you please show me to code it?

    Thanks in advance ๐Ÿ™‚

    • Hi Rabbit, Yes it can. There is an example scene that highlights this: “GeneralBasics2dCS” . The code can be found on lines 53-59 on “GeneralBasicsCS.cs”.

  3. Lex

    Hello, I’m new to Unity and new to LeanTween โ€”ย I really enjoy the similarities of LeanTween and other tween engines I’ve used with other technologies in the past.

    I’m having a difficult time finding and answer to a question, however โ€”ย can I invoke two different tweens on the same game object, specifically, I need to tween scaleY and moveY at the same time โ€”ย but I’m not quite sure how to do that without the tweens overwriting and becoming ‘whacky?’

    Any advice would be appreciated!

    • Hi Lex,
      You shouldn’t have any trouble tweening those two properties at the same time. You can do so like:

      LeanTween.scaleY(this.gameObject, 2f, 1.0f).setEase(LeanTweenType.easeOutBounce);
      LeanTween.moveY(this.gameObject, 2f, 1.0f).setEase(LeanTweenType.easeOutBounce);

      If you have any more questions it is usually best on the the Forum page ๐Ÿ™‚

  4. Florian

    Hello Russell!

    First of all great work! Really love LeanTween, I use it all the time!! =)

    The online documentation (on http://dentedpixel.com/LeanTweenDocumentation/classes/LeanTween.html) seems to describe version 2.31, but the version on the Asset Store is 2.30. A bit misleading. I need to use alphaCanvas, which does not exist in 2.30. For now I hacked around using a value tween, manually getting the CanvasGroup components and setting their alpha in the onUpdate() delegate. Good enough, but not really clean.

    Any release date for the 2.31?

    Thanks for your great work!

    • Hi there Florian,
      Thanks! Glad you like it :). Sorry for the late response, I don’t check my website that much, best to post on the Unity Forums, which I check more often. You can get the latest code on github https://github.com/dentedpixel/LeanTween for the alphaCanvas stuff, but I do hope to put out a new version in the next coming weeks…

Leave a Reply to Lex