Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

LeanTween - A tweening engine that is up to 5x faster than competing engines!

Discussion in 'Assets and Asset Store' started by dentedpixel, Dec 3, 2012.

  1. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,192
    Can you elaborate? How long does it take for this issue to manifest itself? LeanTween drives multiple animations in one of my projects, and I've not noticed it. Is it reproducible? Etc.
     
  2. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    like i said, single-fire tweens still works (sort of, you cannot notice the bug) ... i.e., tweening position from x to y still moves the gameObject from x to y.

    but control over tweens are no longer possible... i.e., stopping tweens on command via uniqueID.
    as i've mentioned earlier, loops are very much visibly affected when simultaneous loops do not start 'simultaneously'.

    -----
    this is my current example scenario,

    gameobject A - set to loop tween size and rotate
    *tweening starts looping size and rotation simultaneously*
    gameobject A no longer a target, cancel tween size and rotate on gameobject A
    *tweening stops under normal circumstances*
    gameobject B is now the new target...set to loop tween size and rotate
    *tweening starts looping size and rotation simultaneously*
    gameobject B no longer a target, cancel tween size and rotate on gameobject B
    *tweening stops under normal circumstances*

    ~~ AFTER BUGGED ~~
    gameobject A - set to loop tween size and rotate
    *tweening starts looping size and rotation simultaneously*
    gameobject A no longer a target, cancel tween size and rotate on gameobject A
    *tweening does not stop at all... both rotation and size continue to loop*
    gameobject B is now the new target...set to loop tween size and rotate
    *tweening starts looping size*
    rotation tween not visible...
    *rotation tween starts after awhile*
    gameobject B no longer a target, cancel tween size and rotate on gameobject B
    *tweening of object A and B still active*

    -------------
    in another case scenario,
    i have set up a 'LeanTween.value()' method to tween a custom value of a specific gameObject when needed.

    under normal circumstances, the gameObject is referenced and the value is changed as desired.

    AFTER BUGGED,
    null reference exception for gameObject being logged... tweening of value cannot proceed as per normal...
     
  3. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Kurayami,

    I haven't done a project where I have really pushed that canceling system to the edge, to test it's limits, as I haven't noticed any issue like the one you are describing. If there is any way you could provide a seperate project that isolates the behavior you are doing, that would be super helpful for debuggging.

    One way you can make sure things are cleaned up without having to do a restart of the game is to call:

    LeanTween.reset();
    LeanTween.init();

    Although you really shouldn't have to ever do this, as it would be best to fix this bug instead...

    Thanks
    Russ
     
  4. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    here is the most basic sample test scene that will fail after around 10-30 secs of usage...

    https://drive.google.com/file/d/0Bx93u3B1G5VcbGVCT1lMSnNSWVk/edit?usp=sharing

    ------
    this package utilizes LeanTween 2.16 from git but it should be the same for the previous few iterations as no new features were used.

    just hit run... as you can see... the loop keeps the boxes within the screen... but after about 10-30 secs (or so), it starts to fail and the boxes are no longer contained within the screen.

    the script to tween the boxes is very simple... i bet a jr programmer could understand it within seconds. the script is attached to the main camera and has reference to the boxes in the screen. keep the timer variable to about 0.4 secs and you will see the results fairly quickly... a faster timer would incur the error faster of course because the uniqueID is eaten up faster... that is an obvious fact right... lolx

    ----------
    FYI, this bug has been around for a very long time... i always thought it was an error in my coding.... until ... i just broke down and cry about why i suck so badly (nahhh just kidding about the breaking down and cry =P )

    but i did waste a lot of time (months actually) trying to revise/improve my code to accomodate/fix the bug which cannot be fixed because it wasn't my error :p
     
    Last edited: Aug 24, 2014
  5. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Awesome, thanks for putting together this test. I will try an get a chance to look at it today.

    Sorry to hear this bug was such a time-killer for you. Hopefully we can get this fixed and save anyone else the headache :-/

    Cheers,
    Russ
     
  6. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    Hi,
    Did you get a chance to look at it yet? any progress?
     
  7. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Kurayami,

    Sorry it took me so long to get to this, I was fixing another bug I thought might be related.

    Now I may not understand the effect you are going for in the code, but I do not understand why you wouldn't want to cancel any tweens in the mover method. Because when I added a cancel before the move, it no longer goes off the screen, like:

    Code (CSharp):
    1. LeanTween.cancel(gos[x],myID[x]);
    2.                     myID[x] = LeanTween.move(gos[x],
    3.                     new Vector3(-60f,gos[x].transform.position.y, gos[x].transform.position.z),timer*5).id;
    Since there are move tweens being called on the Update method, and move tweens being called from the IEnumerator, I think they are calling on top of each other, which would cause unexpected behavior. So added a cancel before that move will insure it is the only tween operating on that gameObject at this time.

    I hope that helps,
    Russ
     
    kurayami88 likes this.
  8. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    i see... now i get the cause of the bug... overlapping tweens...
    ---------------
    which would technically mean if i do this...
    LeanTween.move(*object*, new Vector3(-2f,0f,0f),3f); // tween A
    and then straight away
    LeanTween.move(*object*, new Vector3(2f,0f,0f),2f); // tween B

    the last tween call (tween B) superceeds the first tween (tween A) so nothing strange visible... but as soon as tween B finishes (because its duration only 2f); tween A is still active and causes weird jumping behavior... because the memorized position for tween A is not what tween B already moved...

    but this would mean we need to call "cancel" every time we tween the same object on the same tween type to avoid overlapped tweening...

    will see what i can improve on in my own project... thanks for your feedback :)
    ----
    on the other hand... would it not be better if overlapped tweens "tween" from the actual object's property and not a locally saved value (of which could have been altered and no longer accurate?) ... or perhaps that will incur a great performance hit due to the need to call the object's property value each time a tween runs... i can imagine a drastic drop in performance already... *then again i believe this is where LeanTween harness it's performance over other tween engine, the unnecessary live update call of the object's actual property?)
     
  9. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Yes, it is not advised to do two tweens of the same type on top of one another. However a lot of tweens you can actually call on top of one another, like you could do a moveX and moveY at the same time and they "play nicely" together (or move and scale, and many others).

    Unfortunately it would not make sense to handle this automatically, like you said if I were to check every current tween to see if there is already a tween of this type on this gameObject, it would be a huge overhead. So I leave that up to the programmer to determine and manage.
     
  10. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    I've created this function, hoping that it will constantly rotate the gameobject.

    Code (CSharp):
    1. LeanTween.rotateAround(gameObject, new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)), Random.Range(1f, 359f), duration * Random.Range(0f, 1f)).setLoopClamp();
    As it seems it is constantly rotating the object but each time a cycle ends the object returns to its original rotation. Am I missing something here?
     
  11. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Konsnos,
    Yes that is the expected behavior. Since rotateAround is not adding an additional amount each time, but always rotating based on that initial start position.

    Although I know this is annoying, maybe I can add something like setAddToValue() parameter in the future so it would function in an adding additional amount manner.

    You could achieve something similar to what you are going for with this code

    Code (CSharp):
    1.  
    2. float largeMult = 10000f;
    3. float time = duration * Random.Range(0f, 1f) * largeMult;
    4. float loop = 360f * largeMult;
    5. LeanTween.rotateAround(gameObject, new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)), loop, time).setLoopClamp();
     
  12. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    I'll look at it. Thanks :)
     
  13. svope

    svope

    Joined:
    Jul 6, 2014
    Posts:
    8
    Hi guys,

    I'm having problem with LeanTween + SpriteRenderer. I have a gameobject with SpriteRenderer component. I set up LTSpline like this


    Code (CSharp):
    1.  
    2. // just some points array
    3. private Vector3[][] points_Array = new Vector3[][]
    4.     {
    5.         new Vector3[]{ new Vector3(15.5f,-4f,0f),new Vector3(15.5f,-4f,0f),new Vector3(6.4f,2.2f,0f), new Vector3(0.9f,-0.8f,0f), new Vector3(-6.5f,-4.8f,0f),new Vector3(-6.5f,-4.8f,0f)},
    6.         new Vector3[]{ new Vector3(14.2f,1.8f,0f),new Vector3(14.2f,1.8f,0f),new Vector3(10.8f,1.7f,0f), new Vector3(6f,-1f,0f), new Vector3(0.8f,-1.3f,0f),new Vector3(-6.5f,-4.5f,0f),new Vector3(-6.5f,-4.5f,0f)},
    7.  
    8.     };
    9.     private LTSpline spline;
    10.     private LTDescr descr;
    11.  
    12.     void Start () {
    13.         spline = new LTSpline( points_Array[ Random.Range(0,1)]);
    14.         descr = LeanTween.moveSpline(gameObject,spline.pts,4f).setEase(LeanTweenType.easeInOutSine).setOrientToPath(true).setDelay(2f);
    15.     }
    When I press "Play", the gameObject starts moving along the spline path (Transform component is changing x/y/z pos ) but the sprite is not drawn. If I delete component SpriteRenderer and add Mesh Filter + MeshRenderer everything works fine.
    Why is that? I hope it is just some "stupid overlook".
    Thank you

    SOLVED:
    removed setOrientToPath(true) , added setOrientToPath2d(true)
     
    Last edited: Sep 13, 2014
    dentedpixel likes this.
  14. svope

    svope

    Joined:
    Jul 6, 2014
    Posts:
    8
    Hello there,

    I just want to ask how is it with rigidbodies2d and moving along a spline?
    I have a LTSpline defined where GameObjects with rigidbodies2d component are moving around that defined path. When I put another rigidbody2d object to "block" their path ( obstruct? that spline they are following ) then nothing happens (no physical collision occures ). Is this expected behaviour?

    (yes, ofc there are both rigibody2d + collider component )
     
  15. svope

    svope

    Joined:
    Jul 6, 2014
    Posts:
    8
    Just one more question:

    My GameObjects are following spline-path but even if easing function is "setEase(LeanTweenType.linear)" then GameObjects are slowing down, then just rapidly accelerate etc. This should not be possible with linear easing, am I right?
     
  16. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Svope,

    You probably want to add some code that tells the body to stop tweening when it has collided with another collider. If it can't detect the collision then we would be having a problem...

    But I have non-2d code that does this behavior, and then when it collides with another object quits following the specified path and reacts in a realistic physical way to the "crash"

    I haven't done a ton of 2d sprite support for the Spline/Bezier section of LeanTween, but this is something I am working on next...
     
  17. Toonsylvania

    Toonsylvania

    Joined:
    Jun 1, 2010
    Posts:
    29
    Hey,

    I'm trying to get a screen shake effect on my camera. But my main concern is that I'm updating the camera position according the player position in the LateUpdate. Unfortunately, with LeanTween.value (float) it doesn't work, because I can only call a callback function on every update frame. Would it be possible to get a LeanTween.value with a new parameter to specify when to update (Update, FixedUpdate or LateUpdate)? Or maybe you have a better solution or a workaround to my problem?

    Any help is appreciated. Thanx.
     
  18. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Toonsylvania,
    I have a pretty good camera shake, check out the included ExampleCameraShake scene to see it in action. It uses this code:

    Code (CSharp):
    1. void Start () {
    2.         LeanTween.rotateAround( gameObject, Vector3.up, 1f, 0.2f).setEase( LeanTweenType.easeShake ).setLoopClamp().setRepeat(-1);
    3.         LeanTween.rotateAround( gameObject, Vector3.right, 1f, 0.25f).setEase( LeanTweenType.easeShake ).setLoopClamp().setRepeat(-1).setDelay(0.05f);
    4.     }
    5.  
    I think this can be tweaked to get the exact type of shake you are looking for.

    I hope that helps,
    Russ
     
  19. Toonsylvania

    Toonsylvania

    Joined:
    Jun 1, 2010
    Posts:
    29
    Thanks Russ for this piece of code!

    Your idea of using LeanTween.rotateAround could work, as it would not alter my smooth player follow while still permitting to clamp the camera movement when necessary.

    But how can I make the camera reset to its original rotation at the end of a camera shake (Quaternion.identity in my case...)? I mean smoothly reset... ;)
     
  20. Bllly

    Bllly

    Joined:
    Sep 23, 2014
    Posts:
    5
    Hi Russ,

    I have a problem with LeanTween.removeListener, maybe you can help me. The issue is that removeListener does not seem to work.

    The problem arises when using the following functions in conjunction: ( this code is executed in the same script)
    Code (CSharp):
    1.  
    2. // in an init function...
    3. LeanTween.addListener(gameObject, 0, MoveAway);
    4. // somewhere ondelete ...
    5. Debug.Log(LeanTween.removeListener(gameObject, 0, MoveAway));
    6.  
    It always logs false, which means it couldn't find the corresponding listener to remove, causing the scene to eventually throw the "You ran out of areas to add listeners..." error.


    I'm using LeanTween 2.17, and it looks like
    Code (CSharp):
    1. System.Object.ReferenceEquals( eventListeners[ point ], callback)
    always returns false ( both on line 4035 and 4009 )

    When changing this to:
    Code (CSharp):
    1. System.Object.Equals( eventListeners[ point ], callback)
    It looks like it works... However, I am not quite sure it wont break other things, or if it is an effective fix. Perhaps you have some thoughts.

    Thanks!
     
  21. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Sure, this code works to stop it smoothly on the next shake:

    Code (CSharp):
    1. LTDescr tween1;
    2.     LTDescr tween2;
    3.  
    4.     void Start () {
    5.         tween1 = LeanTween.rotateAroundLocal( gameObject, Vector3.up, 1f, 0.2f).setEase( LeanTweenType.easeShake ).setLoopClamp().setRepeat(-1);
    6.         tween2 = LeanTween.rotateAroundLocal( gameObject, Vector3.right, 1f, 0.25f).setEase( LeanTweenType.easeShake ).setLoopClamp().setRepeat(-1).setDelay(0.05f);
    7.  
    8.         LeanTween.delayedCall(gameObject, 3f, stopShake);
    9.     }
    10.  
    11.     void stopShake(){
    12.         tween1.setRepeat(1);
    13.         tween2.setRepeat(1);
    14.     }
     
  22. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Billy,
    Thanks for pointing this out, this does indeed seem to be a bug. I am working on it now, and I will let you know when I have made progress. This has prompted me to finally setup some of the unit tests I had planned to do, so I can catch errors like this before deployment. If anyone has experience writing unit tests for Unity I would be happy to hear your thoughts.
     
  23. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    268
    Hiya!

    Is there an easy way to modify what LeanTween uses to increment time? I don't want to modify the source, because for all of my GUI tweens I want to use Time.deltaTime. But for network related things, I'm hoping I can adjust the function to use my network deltaTime (Bolt). Is this currently available?
     
  24. Toonsylvania

    Toonsylvania

    Joined:
    Jun 1, 2010
    Posts:
    29
    Unfortunately, it stops the shake but it leaves the camera rotation to a random value. I'd like to make it smoothly reset to its original value (0,0,0).
     
  25. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Yes you can have the tween use either estimatedTime or frames using these methods:
    http://dentedpixel.com/LeanTweenDocumentation/classes/LTDescr.html#method_setUseEstimatedTime
    http://dentedpixel.com/LeanTweenDocumentation/classes/LTDescr.html#method_setUseFrames

    Let me know if that isn't what you were looking for.
     
  26. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    268
    Sadly no, what I need is the ability to pass in a reference variable. The networking package I'm using, Bolt, has it's own deltaTime variable, that is the amount of time since the last update from the server. So I'm hoping to pass in this variable to LeanTween, so the animation runs closely with the server representation.

    I know this is a pretty specific requirement. But do you think others might have need of passing in their own percentage complete/time variable?
     
  27. buptwsg

    buptwsg

    Joined:
    Feb 14, 2014
    Posts:
    5
    hi,
    I'm interested in your engine, and I want to use it with Unity 4.6 new GUI. I took a look at the API doc, and feels that LeanTween.move() doesn't support new GUI. Is that true?
     
  28. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Gumboots,
    It is a sort of specific requirement, but i could see it being helpful in other situations as well, and it is a relatively low-impact easy thing to add. I have put an implementation up on Github, where you can set the deltaTime manually. Let me know if you have any questions or this is what you were looking for. Here is example code:

    Code (CSharp):
    1. void Update ()
    2.     {      
    3.         LeanTween.dtManual = Time.deltaTime;
    4.         if (Input.GetKeyDown(KeyCode.Q))
    5.         {
    6.             LeanTween.scale(this.gameObject, Vector3.one*3f, 1.0f).setUseManualTime(true);          
    7.             print("scale punch time independent!");
    8.         }
    9. }
     
  29. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hello,
    Yes I cannot say, one way or another if it works with the 4.6 GUI. I have not had a chance to get my hands on it. I am suspecting that it doesn't though.

    However you can use LeanTween with any system that uses Rects, so if the new GUI still uses those you can still make it work... Sorry I can't supply more information. I will have to get 4.6 beta soon and play around!
     
  30. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    268
    Hiya!

    That looks spot on. So do I head to your Github to download this? Or will it be migrated into the Asset Store version?
     
  31. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Nice! Download it from Github for the time being, but it will eventually be up in the Unity Asset Store as well (I have some other pending changes, and I like to give it a couple weeks of testing before I push to the asset store).
     
  32. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Does anyone have any leads on how one can get a copy of the Unity 5 beta? :-D

    I would love to start working on the Web GL exporting for LeanTween…
     
  33. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Hi Dented,

    I have an issue with LeanTween.color.

    Color color = Color.white;
    LeanTween.color(gameObject, color, 2).setOnUpdateColor(setColor).setOnComplete(set);

    void setColor(Color color)
    {
    Debug.Log("Color: " + color);
    }

    void set(object p)
    {
    Debug.Log("a");
    }

    The script is attached to an object with mesh renderer and a skyshop material (with _Color shader var).

    I cannot run SetOnUpdateColor during tween ...

    Can you help me please?
     
  34. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Kaz,
    Good catch! That onUpdateColor was broken in that situation. I have a fixed version up on Github: https://github.com/dentedpixel/LeanTween . Let me know if you have any more issues.

    Thanks,
    Russ
     
  35. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Thanks for the fix ! :)
     
  36. steffanPL

    steffanPL

    Joined:
    Oct 9, 2014
    Posts:
    36
    Hello,
    First: greate job, I'm impressed ;]
    And question- I would like to create LTRect with few elements inside (label, button etc.), and then move them simultaneously.
    What's the best way to achieve that ?
    Thanks !
     
  37. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey SteffanPL,

    Thanks for the support :)

    Usually the easiest way if you want to group a bunch of UI elements together is to use a GUI.Window (http://docs.unity3d.com/ScriptReference/GUI.Window.html). Then if you want to animate it at all you just pass an LTRect for the Rect value, similiar to how it's done with buttons and other gui elements.

    I hope that helps!
    Russ
     
  38. steffanPL

    steffanPL

    Joined:
    Oct 9, 2014
    Posts:
    36
    Works like a charm. Thank you :]
     
  39. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Hey Russ,

    1. I have your LeanTweenEditor and wondering how to add events to the visual tween. For example, how to know when a tween or a group of tween begin or end?

    2. Also I'm using curvy spline to create my paths. How to use curvy path with LeanTweenVisual ?

    Cheers.
     
  40. Ilingis

    Ilingis

    Joined:
    Dec 13, 2012
    Posts:
    63
    Beginner using LeanTween here. When I use this function: LeanTween.moveLocal(gameObject, new Vector3(0.0f,2.0f,0.0f), 0.5f); the object move towards the coordinates smoothly but then it appears to be "shaking" for the last two seconds. What am I doing wrong? Using Unity 4.6 and I'm trying to move a sprite.
     
  41. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    747
    I have just updated to the latest version and I think I found a bug. For some peculiar reason, the loop in the isTweening method was changed from this:

    Code (csharp):
    1. for(int i = 0; i < tweenMaxSearch; i++)
    To this:

    Code (csharp):
    1. for(int i = 0; i <= tweenMaxSearch; i++)
    This will invariably cause null reference exception every single time you attempt to use isTweening check, because reference tweens[tweenMaxSearch] can not possibly exist.

    I'm not sure I understand the reason behind that edit, can you elaborate on why it was made? I have reverted it for the meantime, but I'm seeing similar changes to tweenMaxSearch bound loops elsewhere.
     
    Last edited: Oct 26, 2014
  42. DarkPlan

    DarkPlan

    Joined:
    Jan 10, 2013
    Posts:
    15
    Hi,
    I have a simple question, is it possible with LeanTween to cause a full rotation instead of directly tweening to the angle?
    For example my object's angle is (0,0,0), I want to tween to (0,0,20), but I want the tween to go a full rotation before reaching (0,0,20) (so overall it should rotate 380 degrees).

    Is it possible with LeanTween? I tried inputting 380 degrees but it seems to ignore it and just use 20.

    Thanks! :)
     
  43. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    747
    Sure, just use LeanTween.value (tweening type that allows you to call a custom method), like this:
    LeanTween.value (gameObject, MethodName, 0, 380, time);

    And then create your own method (adhering to pattern "void MethodName (float value) { ... }") that will handle proper wrapping of rotations.
     
  44. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Bac9-fcl,
    I didn't realize this adjustment would cause any errors. I changed this because in some situations it would not catch the very last tween, with a < instead of the <= .

    Do you happen to have an example where the isTweening check is causing the failure? I would like to make sure I am making the adjustment correctly.

    Thanks!
    Russ
     
  45. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey DarkPlank,
    The regular rotate method, does have limitations like that. You can use rotateAround, which allows you to do greater than 360 rotations, and in general just works better. It's always in relation to it's current rotation, so if you want to do 380 degrees and you already have 20 degrees rotated you would only rotate it 360 degrees. You also just have to specify the axis you are turning around.
     
  46. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Illingis,
    Sorry for the late reply, I can't really tell why you might be having issues, based on your description. If you want to send me a example project, with your bug I can look at it, and see what the issue is...
     
  47. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
  48. Essential

    Essential

    Joined:
    Sep 8, 2011
    Posts:
    265
    Hey, thanks for the great free software.

    Before calling a tween I wish to check if one is already running. So I use isTweening — but then I get a NullReferenceException because the ~LeanTween object doesn't exist yet. Am I supposed to initialize the LeanTween object myself at the start of a scene somehow?
     
  49. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Essential,
    Not a problem, I am glad you are liking it!

    The issue you are getting is a bug I introduced with the last release. You should be able to do just as you are doing with calling isTweening immediately (before any tweens have started).

    I do have a fix for it, it is up on Github (and will hopefully be on the Asset Store soon too).
     
    Essential likes this.
  50. Essential

    Essential

    Joined:
    Sep 8, 2011
    Posts:
    265
    Is it possible to request a single value for a TweenType? E.g.:

    Code (csharp):
    1. float returnedValue = LeanTween.easeOutQuad( fromValue, toValue, time );
    It's useful to be able to access the easing library for other custom uses.

    // edit: I've found I can technically do it if I rename the method from private to public — any reason we shouldn't be able to do this? :p
     
    Last edited: Dec 1, 2014