Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
  2. lo-94

    lo-94

    Joined:
    Nov 1, 2013
    Posts:
    282
    Which method would you use to start a new tween within the DOTweenAnimation script? I think my confusion is that I'm not seeing where the Tween is actually created within the DOTweenAnimation component and how to easily start a new one with the values set from the inspector (minus the new start and end position)

    Thanks for the help, its been a while since I've worked with this system and am shaking off the rust
     
  3. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    Ah I see, I'm sorry I didn't realise you were using a DoTweenAnimation. You can call DOKill() the DOPlay(), or it looks like you could try RecreateTweenAndPlay()
     
    lo-94 likes this.
  4. lo-94

    lo-94

    Joined:
    Nov 1, 2013
    Posts:
    282
    Sweet, got it with the following code

    Code (CSharp):
    1. public void UpdateTargetPosition(Vector3 position)
    2. {
    3.     DOKill();
    4.     endValueV3 = position;
    5.     CreateTween();
    6.     DOPlay();
    7. }
    Thanks for the help! Much appreciated
     
    DrunkenMastah and flashframe like this.
  5. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    Nice work :)
     
  6. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Hi there
    Is there a possibility DOTween will work with UI Builder/UI Toolkit USS elements?

    Thanks
     
  7. MrApple24

    MrApple24

    Joined:
    Oct 29, 2021
    Posts:
    1
    Question about DoShake.

    I want to use it to simulate an object recoiling from getting hit. If I pass a vector strength of say (1,1,0), I expect the target object to shake with its first impulse somewhere in that general direction. However, in practice, the first impulse direction seems to be completely random.

    Is this intended and my expectations are off?
    Note that I've tried playing with the randomness variable, but it doesn't seem to have much impact unless I set it to zero. Also, I am using it in Bolt.

    Thank you!!
     
  8. lsvjhm

    lsvjhm

    Joined:
    Jul 5, 2019
    Posts:
    2
    Hello, I need to update endValue of DoJump in process, but ChangeEndValue does not work with DoJump. Is there any solution?

    This is my last hope
     
  9. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    68
    Hi!

    Anybody know if it s possible to use transform.DOMoveX into DoTweenAnimation component?
     
  10. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    u can unlick UNIFORM SCALE and then u can just put something on x, y or z ;)
    upload_2021-12-7_16-47-52.png
     
  11. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    @Demigiant Hi. Is it possible to make this setup work ? I tried and it doesnt work for now.

    1. I have a GO with DOT animations and a path. It has 2 childs with triggers (left, right)
    2. I have a child GO on my Player that has a Punch DOT on it that. On trigger enter the above it gets the parent's GO as target for the Punch DOT (this works)
    3. I tried doplay and dorestart on my PunchDOT but it doesnt work.
    4. It is working though to change some parameters.

    What I want to achieve is to have my GO animations and path still working on their own and to have on top of that my Punch on triggerenter.


    And a question regarding Physics. Is it possible to use Dynamic somehow as I would like to use a buoyancy effector on top of the GO animations and Path.
     
  12. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    Can you be clearer about what you are trying to achieve? Maybe provide some images.

    When you say "it doesn't work" - what specifically doesn't work?
     
  13. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Atm I solved to be able to pause so I have high hopes Ill achieve what I asked intialy.

    The current goal is to be able to use physics2d and effectors in one of these situations:

    1. stopping the dot animations and have just the effector and physics applied on some events
    2. having the dot animations running while having phisics2d on top --- the problem is that for using effectors on my DOT GO, i need to use dynamic rb and DOT works only with kinematic or not ?

    Furthermore, another problem I am facing is this:
    My DOT GO (a platform) is moving and my player stands on it.
    I have applied friction and drags an the player does not move with the platform. Why and how shoudl I fix this ?
    Making the player child of platform will not work becasue I have scaling DOT on my platform.
     
  14. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    I think DoTween uses MovePosition to tween rigidbodies, which only applies if they are Kinematic, yes.

    You could still make your player a child of the platform if you reorganise the hierarchy of your platform:

    Platform Parent Object (DOMove)
    -> Platform graphics (DOScale)
    -> Player Game Object
     
  15. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I did exactly that on my own :)))))
    and use on doscale OTHER to reffer to DOMOVE PARENT

    my only problem is to apply physics now to the best of my abilities :)
     
    Last edited: Dec 9, 2021
  16. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    68

    Just checked and...
    I don't have this tickbox.
    Very weird, anybody doen't have it too?
     
  17. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    u could show picture maybe ?
     
  18. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    68
    upload_2021-12-10_14-59-15.png
    That is what I have
     
  19. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    if you want just move on X then let y and z to 0 ....

    and play with check and uncheck relative to see diferences (in some combinations there are)
     
  20. LukeAJones

    LukeAJones

    Joined:
    May 7, 2017
    Posts:
    15
    Question:

    Is there some way to split a tween at a point along it? It seems super handy to be able to make a tween to a desired end location, then cut it up based on the time into a sequence of smaller tweens to have different settings for.

    For example, I have a tween that I want a consistent in and out curve duration for, which as best I can tell means I have to figure out the end positions for the end of the in curve and the end of the straight lerp section (and obviously the end but that's needed regardless).

    Since I already know the cut times and the end point, this could remove the need to manually figure out the positions to end each seperate lerp at.
     
  21. OrderOfOut

    OrderOfOut

    Joined:
    Sep 21, 2018
    Posts:
    37
    Hey all -- can someone explain how DoBlurShift() works? I see it listed as an "EPO" on the documentation website, but no real explanation of what that means or signifies (other than the literal acronym definition). I do notice that it's not recognized by DOTween on my end. Thanks.
     
    Last edited: Dec 15, 2021
  22. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    When I stop playing the game I get :

    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
    The following scene GameObjects were found:
    [DOTween]


    I could be doing something wrong, but is there option to not spawn such game object and component attached to it in the first place?
     
  23. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    That might happen if you try to access DOTween in an OnDestroy method. It's probably a script execution order issue - DOTween gets destroyed first, but then your script tries to access it, so it gets reinstantiated.
     
  24. SeaSand

    SeaSand

    Joined:
    Jan 30, 2016
    Posts:
    11
    Hi,

    Happy New Year to everyone!

    I’ve got a question concerning the Demigiant folder(s):
    Yesterday I began to revive a Unity project that contains DOTween v1.2.420 / Pro v.1.0.244 (according to the DOTween Utility Panel). I don’t remember if I did something wrong when updating DOTween (Pro) months ago, but there are two Demigiant folders in the project - one in /Assets and one in /Assets/Plugins.

    The first one (/Assets/Demigiant/) contains the most DOTween and DOTweenPro stuff,
    the latter (/Assets/Plugins/Demigiant/) only contains a few folders and files:

    …/Dotween/Editor/ (which is an empty folder)

    …/DotweenPro/ which contains the files
    DOTweenDeAudio.cs,
    DOTweenDeUnityExtended.cs,
    and the subfolder /Editor which contains the zip-file DOTweenProEditor
    (which I haven’t extracted yet because I wanted to ask you guys first).

    The Unity Console doesn’t show any errors, but I guess - since v1.2.420 / Pro v.1.0.244 - everything should be in one Demigiant folder in …/Plugins now, right?

    If that’s the case: Should I merge my two Demigiant folders manually by dragging the files from /Assets/Demigiant/ into the respective subfolders of the …/Plugins/Demigiant folder?

    Any ideas/advice?

    Best regards
    SeaSand
     
  25. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Any ideas about this?
     
  26. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I think I am giving up on ui toolkit as I can't get my desired transitions and it is quite annoying.

    Which brings me to this question if someone's already gone through this problem and doesnt mind sharing the solution:

    Is there a way to update a tween's duration? This is how my tween looks like:
    Code (CSharp):
    1. _tween = mesh.material.DOColor(Color.cyan, _frequency).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Restart).OnStepComplete(PlaySound);
    Also, this same tween plays on Start() a million times and it should only play based on a boolean and not on Start() or Awake()

    Thanks!
     
  27. denravonska

    denravonska

    Joined:
    Nov 20, 2020
    Posts:
    12
    Q: What's an appropriate way to tween one of two moving points of a line renderer?

    I'm trying to draw a line from point A to B where to goal is to bounce the line's point at B to give a visual indication of where it's at. Both points are moving so a simple move can't be used since the bounce point won't match reality if the position is updated during animation.

    Right now I'm experimenting with calculating a position delta from when the tween was started and where the target is now, and apply it on each tween update. It seems to mostly be working though I'm getting some overshoot every now and then (could be a problem with my implementation). Is there an easier way to do local tweening between two moving points?
     
  28. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    35
    Hi, I am now going to create a snowboard game. There is a road for the character to ski.
    For example, there are 10 points in the road as a re-start points. Once the ski character hits collider at two sides of road. The character will be back to the middle position of the road as a re-starting points.
    Donnt know if DoTween Pro returns current re-start point values when the character hits either sides of the road collider?
     
  29. Morshu32

    Morshu32

    Joined:
    Jul 13, 2012
    Posts:
    1
    Hi everyone, I just wanted to know if DOTween includes the same functionality as
    transform.RotateAround(point, axis, rotationvalue)


    In short I need to rotate an object around another one over time.
     
    Deeje likes this.
  30. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    When I stop playing the game I get :

    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
    The following scene GameObjects were found:
    [DOTween]

    I could be doing something wrong, but is there option to not spawn such game object and component attached to it in the first place?
     
  31. Thrazamund

    Thrazamund

    Joined:
    Apr 14, 2017
    Posts:
    36
    Hello, I'm unable to figure out a simple problem so far. I want to use Dotween to rotate my camera up when I click by a small amount. I was able to do this DOPunchRotation just fine but decided I would like the camera to stay at the position instead of returning. So, I used DoRotate but when I plug in the same variables I get a completely different rotation and it immediately snaps back. The code side by side looks like:
    Code (CSharp):
    1. cameraTransform.DOPunchRotation(new Vector3(this.transform.rotation.x - 1.07f, this.transform.rotation.y, this.transform.rotation.z), 0.10f, 10, 0);
    2. cameraTransform.DORotate(new Vector3(this.transform.rotation.x - 1.07f, this.transform.rotation.y, this.transform.rotation.z), 0.1f);
    I'm only using the DORotate now though and I get the strange result. Am I missing something obvious?
     
  32. Soundguy

    Soundguy

    Joined:
    Oct 30, 2009
    Posts:
    49
    I'm getting an error in RIder as soon as i finish installing DOTween and open Rider, and this messes up the entire project. Don't know how to fix it, other than completely remove DoTween.

    10:42 Project 'Assembly-CSharp' load failed
    Project 'DOTween.Modules.csproj' targets 'NET_Standard_2_0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. at (1653:5)
    Project 'DOTweenPro.Scripts.csproj' targets 'NET_Standard_2_0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. at (1653:5)


    10:42 Project 'DOTweenPro.Scripts' load failed: Project 'DOTween.Modules.csproj' targets 'NET_Standard_2_0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. at (1653:5)

    10:42 Project 'DOTweenPro.EditorScripts' load failed
    Project 'DOTween.Modules.csproj' targets 'NET_Standard_2_0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. at (1653:5)
    Project 'DOTweenPro.Scripts.csproj' targets 'NET_Standard_2_0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. at (1653:5)


    Unity 2021.2.8f1
    DoTween 1.2.632
    DoTweenPro 1.0.310
    Rider 2021.2.2 / Rider 2020.2.4 (on another machine) / Rider 2021.3.2 (after upgrading because i thought this would be the issue)
     
  33. Lingvist

    Lingvist

    Joined:
    Jul 17, 2020
    Posts:
    6
    Hi, I need some help with DORotate tween. So, I want to make a swining object, that rotates from one side to another, something like on the image below.
    image_026_0000.png

    But it does that tween completely wrong:

    gif_animation_016.gif

    So I wondering is there a way to make such behaviour using DOTween. Of course I can use Joints and all, but I want to try to do it with tweener if possible. If needed there is some code:

    Code (CSharp):
    1.  
    2.         Vector3 firstAngle = new Vector3(15.0f, 90.0f, 0.0f);
    3.         Vector3 secondAngle = new Vector3(-195.0f, 90.0f, 0.0f);
    4.         Vector3 thirdAngle = new Vector3(-90.0f, 90.0f, 0.0f);
    5.  
    6.         Tween firstTween = transform.DORotate(firstAngle, duration);
    7.         Tween secondTween = transform.DORotate(secondAngle, duration);
    8.         Tween thirdTween = transform.DORotate(thirdAngle, duration);
    9.  
    10.         Sequence tweenSequence = DOTween.Sequence();
    11.         tweenSequence.Append(firstTween)
    12.             .Append(secondTween)
    13.             .Append(thirdTween)
    14.             .SetLoops(-1, LoopType.Restart)
    15.             .SetEase(Ease.Linear);
     
  34. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    Does DOTween with Rigidbodies work in Update() or is it limited to FixedUpdate()? That is, can I have a physics system running 10 fps and tween between positions at 60+ fps on Update()?
     
  35. hrohibil

    hrohibil

    Joined:
    Apr 17, 2021
    Posts:
    280
    Hello

    Noob here(sorry).
    I bought the pro version due to its ease of use for non coder.

    I have a pause menu where timescale is set to zero. I want a simple scale up animation when mouse hover over the button and a scale down when exiting the button area.

    any simple method for this? I guess I need some code here.

    when I used the animator I could make the animation and in the animator component chose unscale time..
     
  36. J0hnnieMac

    J0hnnieMac

    Joined:
    Jun 15, 2015
    Posts:
    11
    Did ever get solved , I just hit it today ?
     
  37. leonhogan1

    leonhogan1

    Joined:
    Apr 21, 2020
    Posts:
    13
    but this rewinds the tween. is there a way to set a new end point without rewinding?
     
  38. alexandergikalo

    alexandergikalo

    Joined:
    Oct 24, 2019
    Posts:
    19
    Question about the operation of the OnPause callback:
    Will it work for a Sequence included in another Sequence?
    Example as below. I tried to do it. OnPlayIncludedSequenceCallback works fine (fires exactly at the moment when the execution of the second one starts).
    But the OnPause callback does not work when I pause excludedSequence, when it comes to the includedSequence moment(((

    var includedSequence = DOTween.Sequence().AppendInterval(2).Pause();
    includedSequence.OnPlay(OnPlayIncludedSequenceCallback);
    includedSequence.OnPause(OnPauseIncludedSequenceCallback);

    excludedSequence= DOTween.Sequence().
    Append(transform.DOScale(2, 1)).
    Append(includedSequence);


    If I do Something like that:

    DOTween.Sequence().
    Append(_spriteRenderer.transform.DOScale(3, 1).OnPlay(PlayTest).OnPause(PauseTest))


    OnPause callback fires at start (with OnPlay callback).
    It is very strange(((
     
    Last edited: Feb 23, 2022
  39. MattiaTraverso

    MattiaTraverso

    Joined:
    Feb 28, 2013
    Posts:
    6
    Trying to tween a Quaternion:

    DOTween.To(()=> Rotation, x=> Rotation = x, Quaternion.identity, 1);

    Results in the following error:

    Cannot implicitly convert type 'UnityEngine.Quaternion' to 'ulong'

    Am I doing something wrong? Why is the Lamba expecting a ulong?

    Rotation is just a public Quaternion!

    Thanks :)
     
    WesEnns likes this.
  40. alexandergikalo

    alexandergikalo

    Joined:
    Oct 24, 2019
    Posts:
    19
    I found the problem:
    Sequence().Append calls Pause() for included Tweens. Therefore, I cannot use OnPause callbacks - they are called immediately at the start of sequence.
    Please help solve this problem. I need OnPause callbacks for my logic.

    DOTween.Sequence().
    Append(_spriteRenderer.transform.DOScale(3, 1).OnPlay(PlayTest).OnPause(PauseTest))
     
  41. vivianindatub

    vivianindatub

    Joined:
    Apr 23, 2021
    Posts:
    71
    Am i doing something wrong with DoScale?
    I just want to open a UI panel with doscale but the scales not changing. It's always 1.
    Code (CSharp):
    1. private RectTransform Transform;
    2.     public void OpenUIPanel()
    3.     {
    4.         Transform = GetComponent<RectTransform>();
    5.         //gameObject.SetActive(true);
    6.         Transform.DOScaleY(1, 5);
    7.     }
    8.  
     
  42. Tubestorm

    Tubestorm

    Joined:
    May 8, 2020
    Posts:
    6
    Hey Is there a way to recycle the tweens, it exceeds the init limit and keeps freezing. Also how do you reduce the SpriteRenderer alpha of a gameObject to 0 (any example would do), I'm not very sure how to do it.

    Thank you.
     
  43. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    Question, I use DoMove Tweens for all my player and enemy attack animations, but the problem im running into is A) im constantly getting the "Max Tweens Reached" warning, whenever i pause the game or slow down time.

    Normally it works fine, but whenever I pause the game, if an attack animation is playing and the Timescale is set to 0, it seems like the tweens just keep firing infinitely and every couple seconds the warning raises the max tweens over and over,

    Is there some kind of limit to how many times i can use DoMove? Or is there a way i can pause it if the timescale i 0? I just want to be able to DoMove whenever the enemy or player is attacking, and kill it afterwards. I don't fully understand the Max Tweens Warning.
     
  44. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I just followed this and the GO starts then finishes. I have a red button. When I press it the GO does move the path.
    But the button turns white and stays white and the restart never happens.
    The tween is closed.
     
  45. gnp89

    gnp89

    Joined:
    Jun 25, 2012
    Posts:
    36
    is there a plan to migrate the package to the new UPM system? it would be awesome to include DOTween as a dependency for custom packages!!!
     
  46. gnp89

    gnp89

    Joined:
    Jun 25, 2012
    Posts:
    36
    Oh I see there's an option to create an assembly definition. This helps! having it as a package would be ideal though :)
     
  47. Nuttyfree

    Nuttyfree

    Joined:
    Jan 8, 2021
    Posts:
    1
    Hello, i'm writing a script for a dialogue system, using a tween for the text showing letter by letter. My dialogue is made of an array of Sentences (custom class) which each has a text and a speed value. My script tween the text (string) value with the speed (i'm using the SetSpeedBased(true)) and call this tween again OnComplete (while changing the target sentence). It works perfectly fine but there is an unwanted delay (that is relative to the speed) that happens between each new sentence. I don't know why this is happening and I already tried to setDelay to 0 and i'm not using a sequence.
    Also, this doesn't happen for the first sentence, and i'v checked that the Tween is playing but still waits before tweening.
    Hope you can answer me.

    Code (CSharp):
    1. public void WriteDialogue()
    2.     {      
    3.         texteFin = texteBase + text;
    4.         Debug.Log("Ça tourne");
    5.         tween = DOTween.To(() => texteBase, x => texteBase = x, texteFin, textSpeed).OnStart(Vite).OnComplete(NextSentence).SetEase(Ease.Linear).SetDelay(0).SetSpeedBased(true);
    6.     }
    7.  
    8. public void NextSentence()
    9.     {      
    10.         if (index < maxIndex)
    11.         {          
    12.             index += 1;
    13.             texteBase += " ";
    14.             Read();          
    15.             texteFin += texteBase;
    16.            
    17.             texteFin = texteBase + text;
    18.             Debug.Log("Ça tourne");                    
    19.  
    20.             WriteDialogue();
    21.         }
    22.  
    23. public void Read()
    24.     {
    25.         text = dialogueFile.sentences[index].text;
    26.         textSpeed = (float)dialogueFile.sentences[index].textSpeed;
    27.     }
     
  48. rrtc26

    rrtc26

    Joined:
    Feb 23, 2022
    Posts:
    11
    How can I avoid using DOKill() in this case?
    public void OnPointerEnter(PointerEventData eventData)
    {
    transform.DOScale(1.35f, 0.15f);
    }
    public void OnPointerExit(PointerEventData eventData)
    {
    transform.DOKill();
    transform.DOScale(1, 0.05f);
    }
     
  49. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    A couple of questions with regards to scramble.

    • Scrambling a word that is center aligned is very hard on the eyes (jumps all over the place). The example is left justified and that looks fine. Is there a way to make it smoother when center aligned?
    • Can you scramble one character at a time? For example 12345, scramble 1 only when I click button, and then only scramble 4 when I click another button.
    I have the pro version.
     
  50. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338

    Did you ever find this? Exactly what I need.