Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

DOTween (HOTween v2), a Unity tween engine

Discussion in 'Assets and Asset Store' started by Izitmee, Aug 5, 2014.

  1. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Honor to @pea for the answers! Thanks! :)

    Just an addition, about custom ease functions. While using an AnimationCurve is definitely the easiest way to go (because creating custom ease functions is definitely not an easy job), if you really want a custom ease function the EaseFactory example is maybe even too much, because that actually applies an ease to an ease. Instead, you just have to pass an EaseFunction delegate to SetEase. For example:
    Code (csharp):
    1. // Custom ease function
    2. // Must return a value between 0 and 1
    3. public float MyLinearEase(float time, float duration, float overshootOrAmplitude, float period)
    4. {
    5.     return time / duration;
    6. }
    7.  
    8. public void CreateATween()
    9. {
    10.    myTransform.DOMoveX(2, 1).SetEase(MyLinearEase);
    11. }
     
  2. CryoWraith

    CryoWraith

    Joined:
    Apr 3, 2013
    Posts:
    7
    No I don't get it. The description of Join is exactly what I am looking for, except that it is not working as I thought it would.

    Or you could tell me what's the difference in result between the 2 snippets below? I'm expecting both to have the same result, but I'm wrong.

    Code (CSharp):
    1.  
    2.                 DOTween.Sequence()
    3.                 .Append(testTransform.DOMoveY(600f, 2f))
    4.                     .Append(testTransform.DOMoveY(0f, 2f))
    5.                     .Join(testTransform.DOScale(2f, 2f));
    Code (CSharp):
    1.  
    2.                 DOTween.Sequence()
    3.                 .Append(testTransform.DOMoveY(600f, 2f))
    4.                     .Append(testTransform.DOMoveY(0f, 2f))
    5.                     .Insert(2f, testTransform.DOScale(2f, 2f));
     
  3. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Ah, sorry I misunderstood you. These should have the same result! In fact I did a quick test to confirm that.
     
  4. CryoWraith

    CryoWraith

    Joined:
    Apr 3, 2013
    Posts:
    7
    So... It's a bug?
     
  5. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Can you reproduce it in an empty scene or new project? I can't. Works fine here.

    Also, which version are you using? I'm using DOTween 1.1.060.

    P.S.: I see my previous post was unclear. I did a test to confirm that indeed those two methods produce exactly the same result.
     
    Last edited: Nov 11, 2015
    Izitmee likes this.
  6. CryoWraith

    CryoWraith

    Joined:
    Apr 3, 2013
    Posts:
    7
    I'm using DOTween 1.0.800. Unity 5.2.2p1.

    I've attached the repro in an empty scene.
     

    Attached Files:

  7. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Seems to be a bug in that version of DOTween! Works fine with the latest:

    works.gif
     
    Izitmee likes this.
  8. CryoWraith

    CryoWraith

    Joined:
    Apr 3, 2013
    Posts:
    7
    Ok I'll try with the latest version and see. Thanks.

    UPDATE: Ok, it's working with v1.1.060. Btw the DOTween in Asset Store has not been updated for quite some time.
     
    Last edited: Nov 12, 2015
    pea likes this.
  9. robin-gallimard

    robin-gallimard

    Joined:
    Feb 2, 2015
    Posts:
    6
    Thanks !!
     
  10. Little-Big-Monkey

    Little-Big-Monkey

    Joined:
    Mar 4, 2014
    Posts:
    32
    Hi Izitmee,

    I'm trying to build for Windows 8.1 Universal from Unity 5.1.0 / DoTween 1.0.750 / Pro 0.9.290
    And I'm getting this error :

    Do you have a quick fix ?
    Thank you
     
  11. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    861
    HI Mr Giardini

    So im finally digging my teeth into DoTween and building my new pinball light sequencer YAY. but I have hit a snag ..

    So I set up caching the created tweens and reusing them using "ChangeValues()" but now I realize I cant change the looping or loop type ? The docs say you cant change it is the tween is started , I tried using pause() and rewind() and it did not help. how can I update these loop values then? I basically want to always call ChangeValues() and SetLoops() every time I reuse the tween. let me know ..

    chat soon ;)
     
  12. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @shaderbytes Hello Ian!!! Uhmmm you can't really reuse a tween if you also want to change the loops, sorry :p But DOTween is much more lightweight than HOTween, so recreating a new one with new loops shouldn't be a problem at all ;)

    @Little Big Monkey Hello! Sorry for being late! Damn notifications didn't fire (again). Uhm, that is a weird error. I'm gonna investigate immediately, but in the meantime, can you tell me what type of compilation settings are you using?
     
  13. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
  14. renderhjs

    renderhjs

    Joined:
    Aug 16, 2011
    Posts:
    90
    At work we kept getting this issue lately - and since our UI uses DoTween's a lot it pretty much crashes the app or makes it unusable.
    ...So I downloaded the source code from the GIT repository and imported it to Unity and actually debugged what was going on.

    In a nutshell an index inside DOTween is negative and thus exceeds the bounds of the array. I pinpointed the problem to be the RemoveActiveTween(Tween t) method which simply -- decreases indexes without any logical check. Obviously something is not correct and some tweens are removed more than they should hence why I think the index goes negative.

    [​IMG]

    My fix is at the end where it clams all of the indexes to be above 0 and for now this seems to fix these issues. Of course in a bigger picture it would be important to fix the issue of tweens being removed to many times and thus going negative, but for now this worked for me.
     
  15. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @renderhjs Any chance you can reproduce it in a project and send it to me? I tried many times to replicate this issue but I can't, and being able to replicate it would go a long way in helping me to fix it (as you correctly say, I don't want to solve it with a clamp, but by pinpointing it better).

    As a note, consider that this issue is somehow related to the tweens capacity being increased at runtime, so you can even simply set it as large as you'll need it from the start, using SetTweensCapacity, and this error should go away.
     
  16. renderhjs

    renderhjs

    Joined:
    Aug 16, 2011
    Posts:
    90
    That is not the issue - its what we assumed at first as well but when I traced out the index and compared it against the array length I noticed that the index was turning into -2, -3,...-7 i some cases and with that I could try to set the array size as large as I want but a negative index of an array is always going to throw that error.

    The odd thing was that from 3 devs at first only 1 was getting the issue, the next day the next dev got it and today I was getting it over and over on certain interactions but enough variety that it could and did happen at to many various spots in the app. I noticed in the source code some constants for the indexes - perhaps there is a way that some variables are not flushed from or into the play and editor mode? But then again we also got the errors frequently the last few days on mobile devices. Ironically the other day the build was just fine and builds only from one of the other devs was affected. We could not make out any code changes that could have affected this hence why I made the effort into fixing the exception at the plugin core for us.
    Our project is very complex and even if I would try to isolate something I might not end up with the same errors simply because it does not effect every computer at my work. All I can tell you is that the index went negative when certain tweens were killed (myTween.Kill()) and somehow internally the index was not kept in balance.

    Aside from that I have been using and promoting DoTween for our projects for a while now and am more than happy to share some techniques and ideas that we use (e.g. use curves on the tweens using the SetCurve(...) as a workflow). Its one of the very few Unity plugins / extensions that I really like.
     
  17. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @renderhjs Thanks for the additional info. I updated the TweenManager using your fix (see attached version). Now the error will be taken care of, but a log will be thrown asking to send info about it. By the way, could you write me the full log when that happens? Maybe that might help.

    Also, how are you using curves on the tweens? I'm very curious!

    Cheers!
     

    Attached Files:

  18. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Could it be possible to have a better control on the Shake?
    Currently it's maxShake -> interpolate -> noShake
    What if I want noShake -> maxShake -> noShake ? :)
     
  19. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    58
    Heya,

    I wonder if it's possible to use DOShakePosition on a camera, and also change it's transform position at the same time.

    I would like to increase my camera on the y-axis while causing it to shake.
    However, the shake seems to override it, probably by design.

    So what would you suggest to overcome it?

    Thanks a lot,
    Koby
     
  20. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @funshark Mhmm that is interesting! Added it to my todo list, but my next week will be hell and I already have to find the time to update other DOTween stuff, so it might take a while :p

    @kobyle In such a case, I would recommend to put your camera inside a parent object. Then you can move the parent and shake the camera :)
     
    kobyle likes this.
  21. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    @Izitmee yeah no prob! You're already super fast :) thx for adding it !
     
  22. atpkewl

    atpkewl

    Joined:
    Jun 30, 2015
    Posts:
    14
    Hi @Izitmee

    How do I add Delay to an infinite Sequence ?

    SequenceTapSequence = DOTween.Sequence ();
    TapSequence.Append(TapObject.GetComponent<Image> ().DOFade (0, 0.2f));
    --->> add delay here
    TapSequence.Append(TapObject.GetComponent<Image> ().DOFade (1, 0.2f));
    --->> add delay here

    TapSequence.SetLoops (-1, LoopType.Yoyo);
     
    Last edited: Nov 29, 2015
  23. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
  24. mikatu

    mikatu

    Joined:
    Aug 3, 2015
    Posts:
    27
    Is there a way to apply easing function on amount vibration in DOShake-functions? For example, vibration would start off slow and get stronger till the end.
     
    kobyle likes this.
  25. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @mikatu You can apply an ease, but it won't work on the shake amount, only on the speed with which we move from one shake amount to the other. Still, if you want to shake something from min to max instead of max to min, you could use a trick: PlayBackwards.

    Code (csharp):
    1. Tween t = transform.DOShakePosition(4, 2).SetAutoKill(false);
    2. t.Complete();
    3. t.PlayBackwards();
     
    mikatu likes this.
  26. mikatu

    mikatu

    Joined:
    Aug 3, 2015
    Posts:
    27
    That's clever! I guess it is currently not possible to use backwards-playing tween in sequences. Launching them using callbacks seems to work for me though.
     
  27. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Nope, the direction of nested tweens is indeed determined by the parent Sequence.
     
  28. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    DOTWEEN UPDATE v1.1.135
    • NEW: DOTween Inspector > Added buttons to show more data about playing/paused tweens
    • BUGFIX: Fixed SpeedBased not calculating the correct time with rich-text string tweens

    DOTween_inspectorplus.png
     
    JakeTBear likes this.
  29. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Side announcement > DEMILIB

    Hi! Just a quick post to let you know that, in case you're interested, I made my latest Unity toolset open source, so here comes DemiLib. It's a collection of Unity tools and utilities, mostly barebone and alpha for now, but there's a fully functional Scenes Panel and a functional (but alpha - I'm using it in a couple of projects, but the API might change in the future) Audio Manager (DeAudio).

    [​IMG]
    [​IMG]
     
    Manny Calavera likes this.
  30. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    58
    Heya,

    I have a problem regarding DOKill, in the following code:

    Code (CSharp):
    1.  
    2. Void Jump()
    3. {
    4.    DOTween.DOKill("JumpTween")
    5.    m_Transform.DOJump(pos, height,0, duration).SetId("JumpTween").SetRecyclable(true)
    6.               .OnStart(()=>Debug.Log("Start")
    7.               .OnComplete(()=>{Debug.Log("Complete"); Jump();});
    8. }
    This function will be called according to user input (on the Update function).
    I kill the tween before executing it again, to make sure only 1 is being executed.
    Usually, this works as I expected - meaning the old tween is killed before executing the DOJump.

    However, on some very rare occasions it seems that the Kill is not being executed before the DOJump, and what I get are two "Complete" messages, BUT on that occasion Jump() wont get called which breaks my game.

    Even if I try to kill "JumpTween" with Complete = true, it still wont call Jump() on OnComplete (race condition again?)

    I managed to replicate that error by executing this code on Start: DOVirtual.DelayedCall(2f, () => DOTween.DOKill("JumpTween"))


    1. After calling DOKill, I guess I can't assume that the tween will be killed right away before the second line?
    2. Is there something I can do to make it run that way? (execute second line only after kill is finished) - something like WaitForKill but without the need to be on a coroutine.
    3. I tried using the OnKill method on DoJump, but it doesn't fit my needs.

    4. And last important thing: is it possible for you to create/expose a property on a tween (or perhaps DOTween.GetLeftDuration(tween)) to know how much duration left for the tween until its completion? it would help so much and it will enable me to remove some delayed calls which I create on my sequences (tried to create it with coroutines, but unity coroutine WaitForSeconds are not as accurate as DOTween).


    Thanks!
    Koby
     
    Last edited: Dec 9, 2015
  31. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @kobyle Ahoy! I tried to replicate your code but everything works correctly here. Since I noticed that you re-wrote the code instead of pasting it, can you just paste the original, so I can check it out better?

    1. Yes, indeed the Kill should happen immediately
    4. You can know the duration left on a tween by using myTween.Duration() - myTween.Elapsed().
     
  32. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    58
    Heya @Izitmee !

    About 1:
    My code is a bit more complicated, any chance we can take it privately ?

    About 4:
    What about transform.DOJump(), can I access its duration? since this is in fact a sequence?
    It would be real nice if I could use some static DOTween method with an id to get the elapsed time and the duration.

    If you dont think you'll be able to add it to the framework, any tip on how to know the elapsed time bymyself?

    Thanks again,
    Koby
     
    Last edited: Dec 10, 2015
  33. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hola @kobyle !
    About the About 1:
    Sure! Gonna send you a private message with my mail

    About the About 4:
    The Elapsed and Duration methods work on Tweeners, Sequences, and simple Tweens, so yes. But if you want to use a static method with an ID, you can do this (if you're sure there's only one tween with that ID and that it actually exists):
    Code (csharp):
    1. Tween t = TweensById(myID)[0];
    2. float timeToCompletion = t.Duration() - t.Elapsed();
    I don't plan to add static Duration and Elapsed method by ID, because usually IDs are used with more than one tween, so that would be useless :p
     
    kobyle likes this.
  34. bigcatsobig

    bigcatsobig

    Joined:
    Dec 9, 2014
    Posts:
    9
    Hi

    When I Use Tweener.ChangeEndValue(), it create garbage.
    ChageStartValue(), ChangeValues() too

    how to make grabage to 0?

    Code (CSharp):
    1.            Tweener m_twChangeDirection = null;
    2.          
    3.            ....
    4.  
    5.             if (m_twChangeDirection != null)
    6.             {
    7.                 Profiler.BeginSample("Change Direction");
    8. m_twChangeDirection.ChangeEndValue(m_v3ChangeDirection, fTime);
    9.                 Profiler.EndSample();
    10.                 m_twChangeDirection.Play();
    11.             }
    12.             else
    13.             {
    14.                 m_twChangeDirection = transform.DORotate(m_v3ChangeDirection, fTime).SetUpdate(UpdateType.Fixed).SetRecyclable(false).SetAutoKill(false);
    15.             }
     

    Attached Files:

  35. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    174
    @Izitmee, @shaderbytes
    I actually spent sometime to realize that: design of DOTween recommends users typically just create new tweens without considering reusing exited tweens. DOTween has a global pooling system that reuses tween instances automatically, which makes creating new tweens very efficiently.

    Many users including me asked questions in this thread like "how do I reuse a tween appropriately?"
    But some of them actually want to know that "how to redo the same/similar tween action in an appropriately way?"

    To the second question, my current answer is that:
    Save the tweening states (e.g. end value of a transform) and tweening settings (e.g. settings saved in TweenParams). Then, when you want to do the same/similar tween actions later, just use these saved tweening states and settings to create a new tween.
    Izitmee, please correct me if my thought above is wrong.

    Is there any scenario, in which reusing an existed tween is necessary or recommended?
    For example, an user creates a big tween sequence that contains many tweens. The user wants an object to keep replaying the same sequence all the time.

    In addition, in the DOTween documentation, you mentioned that TweenParams is from HOTween.
    Will you deprecate of using TweenParams in the future?
     
    Last edited: Dec 12, 2015
  36. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    861
    @Dan2013 Thanks , I do see it mentions doing pooling internally now. I Still went forward keeping my tween cached as best possible and only created a new tween when the loop count or type changed.

    My usage is for a complex pinball lighting sequencer and so each emission object type has its own tween and they can be triggered from several different controlling sequence objects, or even sequence groups that control sequence objects, sometimes the params are the same and sometimes they are not.

    In regards to tweenParams this doesnt bother me to much since I have created my own params system for these emission objects. In fact my whole set of classes for this emission system is as separated from DOTween as possible. Not because there is anything wrong with DOTween but its something I learnt over years of development. So If Dotween API changes or for some other reason you have to use something else .. your frameworks logic remains intact upto the last point of implementation where you set and use the tweens.

    Its working like a charm , here have a look , its just my first show and tell but there is one sequence group in action here , it is triggering different sequence objects ( even overlapping them ) and these sequence objects set and trigger the various emission objects.



    here is my abstract class for a emission object :

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using System;
    5. using DG.Tweening;
    6. public abstract class EmissionObjectBase : IndexedDevice{
    7.  
    8.  
    9.  
    10.     protected EmissionObjectParams nonSequencedParams;
    11.     protected EmissionObjectParams sequencedParams;
    12.     protected EmissionObjectParams.EmissionObjectAnimationLoopType loopTypeCache = EmissionObjectParams.EmissionObjectAnimationLoopType.NONE;
    13.     protected Tweener tween;
    14.     protected bool newTweenRequired = true;
    15.     public int registeredSequenceCount = 0;
    16.  
    17.  
    18.  
    19.  
    20.     public void SetNonSequenceParams(EmissionObjectParams newNonSequenceParams, bool setAndApply){
    21.         nonSequencedParams = newNonSequenceParams;
    22.         if (setAndApply) {
    23.             ApplyParams (nonSequencedParams);
    24.         }
    25.  
    26.  
    27.     }
    28.  
    29.     public void SetSequenceParams(EmissionObjectParams newSequenceParams, bool setAndApply){
    30.  
    31.         sequencedParams = newSequenceParams;
    32.         if (setAndApply) {
    33.  
    34.             ApplyParams (sequencedParams);
    35.         }
    36.        
    37.     }
    38.  
    39.     protected abstract void ApplyParams (EmissionObjectParams paramsToApply);
    40.  
    41.     public void ValidateSequenceCompletions(){
    42.         if (registeredSequenceCount < 0) {
    43.             registeredSequenceCount = 0;
    44.         }
    45.         if (registeredSequenceCount == 0) {
    46.             ApplyParams (nonSequencedParams);
    47.         }
    48.     }
    49.  
    50.  
    51.  
    52.  
    53.  
    54. }
    55.  
    and this is what a concrete ApplyParams method looks like in one of my various implementations :

    Code (csharp):
    1.  
    2. protected override void ApplyParams(EmissionObjectParams paramsToApply){
    3.  
    4.  
    5.  
    6.         if (paramsToApply.objectState == EmissionObjectParams.EmissionObjectStates.STATIC_ON) {
    7.             materialInstanced.SetColor("_EmissionColor",paramsToApply.emissionValueMax*startColor);
    8.             return;
    9.         }
    10.  
    11.         if (paramsToApply.objectState == EmissionObjectParams.EmissionObjectStates.STATIC_OFF) {
    12.             materialInstanced.SetColor("_EmissionColor",paramsToApply.emissionValueMin*startColor);
    13.             return;
    14.  
    15.         }
    16.         if (loopTypeCache != paramsToApply.loopType) {
    17.             loopTypeCache = paramsToApply.loopType;
    18.             if(tween != null){
    19.                 tween.Kill();
    20.             }
    21.             newTweenRequired = true;
    22.  
    23.         }
    24.  
    25.         if (paramsToApply.objectState == EmissionObjectParams.EmissionObjectStates.ANIMATING_MIN_MAX) {
    26.             if(newTweenRequired){
    27.                 newTweenRequired = false;
    28.                 tween = materialInstanced.DOColor(paramsToApply.emissionValueMax*startColor, "_EmissionColor", paramsToApply.timeLength).SetAutoKill(false);
    29.                 if (paramsToApply.loopType == EmissionObjectParams.EmissionObjectAnimationLoopType.RESTART) {
    30.                    
    31.                     tween.SetLoops (paramsToApply.loopValue, LoopType.Restart);
    32.                 }
    33.                 if (paramsToApply.loopType == EmissionObjectParams.EmissionObjectAnimationLoopType.YOYO) {
    34.                    
    35.                     tween.SetLoops (paramsToApply.loopValue, LoopType.Yoyo);
    36.                 }
    37.             }
    38.             if(paramsToApply.startAnimationFromCurrentValue){
    39.                 tween.ChangeEndValue(paramsToApply.emissionValueMax*startColor,paramsToApply.timeLength,true);
    40.             }else{
    41.                 tween.ChangeValues(paramsToApply.emissionValueMin*startColor,paramsToApply.emissionValueMax*startColor,paramsToApply.timeLength);
    42.             }
    43.             tween.Play();
    44.        
    45.         }
    46.  
    47.         if (paramsToApply.objectState == EmissionObjectParams.EmissionObjectStates.ANIMATING_MAX_MIN) {
    48.  
    49.  
    50.  
    51.             if(newTweenRequired){
    52.                 newTweenRequired = false;
    53.                 tween = materialInstanced.DOColor(paramsToApply.emissionValueMin*startColor, "_EmissionColor", paramsToApply.timeLength).SetAutoKill(false);
    54.                 if (paramsToApply.loopType == EmissionObjectParams.EmissionObjectAnimationLoopType.RESTART) {
    55.                    
    56.                     tween.SetLoops (paramsToApply.loopValue, LoopType.Restart);
    57.                 }
    58.                 if (paramsToApply.loopType == EmissionObjectParams.EmissionObjectAnimationLoopType.YOYO) {
    59.                    
    60.                     tween.SetLoops (paramsToApply.loopValue, LoopType.Yoyo);
    61.                 }
    62.             }
    63.             if(paramsToApply.startAnimationFromCurrentValue){
    64.                 tween.ChangeEndValue(paramsToApply.emissionValueMin*startColor,paramsToApply.timeLength,true);
    65.             }else{
    66.                 tween.ChangeValues(paramsToApply.emissionValueMax*startColor,paramsToApply.emissionValueMin*startColor,paramsToApply.timeLength);
    67.             }
    68.             tween.Play();
    69.            
    70.         }
    71.  
    72.            
    73.        
    74.     }
    75.  
     
    Dan2013 likes this.
  37. glangdon

    glangdon

    Joined:
    Aug 10, 2013
    Posts:
    1
    Hi, I've been enjoying using DOTween for a small hobby project. One small issue I have is with the "ease overshoot" variable, especially when using the Elastic ease. It doesn't seem to do anything if I set it lower than 0.1 or so, and I'd like the overshoot to be a lot more subtle.

    Is there any way the cap can be reduced so that the overshoot could be made more subtle?
     
  38. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    355
    Hi

    I just upgraded to latest DOTween and saw these errors on Unity 5.2.3

    Assets/Demigiant/DOTweenPro/DOTweenAnimation.cs(259,55): error CS1928: Type `TMPro.TextMeshProUGUI' does not contain a member `DOText' and the best extension method overload `DG.Tweening.ShortcutExtensions46.DOText(this UnityEngine.UI.Text, string, float, bool, DG.Tweening.ScrambleMode, string)' has some invalid arguments

    Assets/Demigiant/DOTweenPro/DOTweenAnimation.cs(259,55): error CS1929: Extension method instance type `TMPro.TextMeshProUGUI' cannot be converted to `UnityEngine.UI.Text'

    Assets/Demigiant/DOTweenPro/DOTweenAnimation.cs(262,51): error CS1928: Type `TMPro.TextMeshPro' does not contain a member `DOText' and the best extension method overload `DG.Tweening.ShortcutExtensions46.DOText(this UnityEngine.UI.Text, string, float, bool, DG.Tweening.ScrambleMode, string)' has some invalid arguments

    Assets/Demigiant/DOTweenPro/DOTweenAnimation.cs(262,51): error CS1929: Extension method instance type `TMPro.TextMeshPro' cannot be converted to `UnityEngine.UI.Text'

    .. so the DT Control panel never came up

    I saw the DOTweenTextMeshPro.cs.addon file and renamed to DOTweenTextMeshPro.cs and it seemed ok.

    Is this the expected experience, or have I missed something?

    cheers

    Nalin
     
  39. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @puzzlekings Uh, that is weird, and definitely not the expected experience. I guess you got those errors because you completely removed DOTween + Pro before updating? Though even in that case, sometimes Unity blocks the DOTween Utility panel to appear automatically, but it should still be able to be accessed via Unity's menu (because DLLs work even if there are errors in the project).

    @glangdon The Elastic ease is a beautiful algorithm created by Robert Penner, so it's pretty standard. That said, I understand what you mean and it sometimes happened to me too. In those cases, the best way to get the smoothest values from the Elastic algorithm is to increase the duration of the tween.

    @shaderbytes Wahhh the Elvis flipper is awesome!!!! :) When are we gonna get a Prince one? :D

    @Dan2013 You're absolutely right, though I recommend to keep tweens stored and not recreate them if they're exactly the same. This is because of two main reasons:
    1. It's true that DOTween recycles a lot of stuff internally, but if you really have the same exact animation it's still better to keep it
    2. Having the same animation on the ready allows to play with tween effects like Play/Restart/Rewind/PlayBackwards. For example, for UIs that appear and disappear I always keep the same tween and just play it forward or backwards. That way, whenever I want to activate, it will play from the exact point in time where it was
    Cheers :)
     
    Dan2013 likes this.
  40. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    174
    In the DOTween documentation, you mentioned that TweenParams is from HOTween.
    Will you deprecate of using TweenParams in the future?
     
  41. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Dan2013 Sorry, forgot to reply to that! Absolutely not! Now that they're in, they're gonna stay in! Also, I find them pretty useful sometimes ;)
     
  42. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    174
    Yes, they are pretty useful.
    Thanks. :)
     
  43. bigcatsobig

    bigcatsobig

    Joined:
    Dec 9, 2014
    Posts:
    9
    Last edited: Dec 15, 2015
  44. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @bigcatsobig Hi! There is indeed a minimal allocation which is unavoidable, and is due to the fact that the changeValue must be accepted as an object and then cast as the actual value type. The allocation is minimal (28B), and I believe it's better than having a bigger Tweener class with overloads for every value type.
     
  45. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    199
    Hi,
    How to make multiple objects follow same created path ? currently object having the DOTween Path itself moved around the path. I want to create a separate path and make multiple objects move along the path. is it possible ?
     
  46. bigcatsobig

    bigcatsobig

    Joined:
    Dec 9, 2014
    Posts:
    9
    @lztimee
    Yes, I understand~
    Thank ;)
     
  47. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    861
    OK I dont know enough about profiling and GC amounts but when you Im tweening over 60 objects for a very short duration like 0.4 seconds in my light sequencer and always setting new values via these methods that have boxing/unboxing then collectively I see its Allocating 17.8kb on that single frame , this is obviously not happening every frame , but it happens rather frequently based on the nature of many tween running and many values constantly changing
     
  48. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    452
    Is the last HC version correct?

    I downloaded it now, http://dotween.demigiant.com/downloads/DOTween_1_1_135_hc.zip, but when I install it, it shows me Version 1.0.800.

    And I got some strange errors :

    Code (csharp):
    1.  
    2. Assets/_Game/Scripts/Utils/Loading.cs(124,37): error CS0029: Cannot implicitly convert type `UnityEngine.Color32' to `DG.Tweening.Core.Surrogates.ColorWrapper'
    3. Assets/_Game/Scripts/Utils/Loading.cs(124,37): error CS1662: Cannot convert `lambda expression' to delegate type `DG.Tweening.Core.DOGetter<DG.Tweening.Core.Surrogates.ColorWrapper>' because some of the return types in the block are not implicitly convertible to the delegate return type
    4. Assets/_Game/Scripts/Utils/Loading.cs(173,37): error CS0029: Cannot implicitly convert type `UnityEngine.Color32' to `DG.Tweening.Core.Surrogates.ColorWrapper'
    5. Assets/_Game/Scripts/Utils/Loading.cs(173,37): error CS1662: Cannot convert `lambda expression' to delegate type `DG.Tweening.Core.DOGetter<DG.Tweening.Core.Surrogates.ColorWrapper>' because some of the return types in the block are not implicitly convertible to the delegate return type
    6.  
    Is this version compatible with Windows Store IL2CPP?

    Thanks
     
  49. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Hey I have this sequence setup

    Code (csharp):
    1.  
    2.     void Start () {
    3.        s =  DOTween.Sequence();
    4.         s.Append(transform.DOMove(transform.position + new Vector3(0, 0.1f, 0),0.1f).SetDelay(InitialDelay));
    5.         s.Append(transform.DOMove(transform.position + new Vector3(0, 1, 0), ExpandSpeed).SetDelay(ExpandDelay));
    6.         s.Append(transform.DOMove(transform.position - new Vector3(0, 1.1f, 0), RetractSpeed).SetDelay(RetractDelay));
    7.         s.SetLoops(-1, LoopType.Restart);
    8.     }
    9.  
    But on every restart the duration takes longer and longer.
    Any Idea what im doing wrong?
     
  50. SirDorius9

    SirDorius9

    Joined:
    Feb 3, 2014
    Posts:
    7
    Hey! This is the first time I'm posting in this thread, so I want to take the opportunity to thank Demigiant for the fantastic work done on DOTween and HOTween before it.

    Secondly, I would like some help with a problem I've been having in different instances. Basically, every time I want to tween some value constantly during the game (no defined end time, like a camera following the player or the player rotating towards the mouse pointer) and using speed rather than time I have this problem where the first time I call the tween, speed works as intended, but if I update the end point of the tween, it seems to ignore speed. Here is some reference code for a following camera code.

    Code (CSharp):
    1. void Start () {
    2.     tweener = transform.DOMove(GetTargetPos(), speed).SetSpeedBased().SetAutoKill(false).SetUpdate(UpdateType.Late);
    3. }
    4.  
    5. void Update() {
    6.     tweener.ChangeEndValue(GetTargetPos(), true);
    7.     if (!tweener.IsPlaying()) tweener.Play();
    8. }
    Is there no way to make ChangeEndValue() work in unison with SetSpeedBased()? Should I just discard the Tween and create a new one each Update? And isn't that worse performance wise?