Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    This error means you are passing an invalid argument/parameter. My guess is that you need to explicitly declare _wayPointsA as a Vector3[]

    i.e.

    Code (CSharp):
    1. public Vector[] _wayPointsA = new Vector3[] { etc....};
     
  2. DavidNLN

    DavidNLN

    Joined:
    Sep 27, 2018
    Posts:
    53
    Hi, I would love some help, I'm trying to create a gently floating effect for a sprite.
    I tried the following code but it not quite right,
    Code (CSharp):
    1. void Start()
    2.     {
    3.         Sequence sequence = DOTween.Sequence();
    4.         var maxPosition = new Vector2(transform.position.x, maxY + transform.position.y);
    5.  
    6.         sequence
    7.             .Append(transform.DOMove(maxPosition, 1f))
    8.             .SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);
    9.     }
    Any tips on how I can make this look good ?
     
  3. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    A little hard to help without knowing exactly what the problem is. But if it's the easing that looks wrong, one thing I'd say is that when using a sequence, both the Tween inside the sequence and the sequence itself can be eased. If your default ease is not set to Ease.InOutSine, then the tween you've put inside that sequence is going to have the wrong easing applied.

    Since you only have one tween in the sequence, you could just use a Tween and get rid of the sequence altogether. Otherwise, try adding a .SetEase(Ease.InOutSine) to the end of DOMove(maxPosition, 1f)
     
  4. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    192
    My math skills are a whole lot worse than I had thought. I have a cylinder that I want to move, relative to its current position, by 0.5 units. I would like to use DOLocalMoveZ, and I've tried so many different variations of the "To" position, but the cylinder goes everywhere except where I want it. Obviously there is something wrong with my local position calculations, but I must be missing something fundamental because I cannot seem to arrive at the correct value. Can anyone help?

    Also, does anyone know of a detailed tutorial for using DOTween?
     
  5. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    Can you post your script / what you've tried?
     
  6. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    192
    Definitely. I didn't put it up earlier because I thought it was too amateurish.

    I have a 2 metre long cylinder that I want to move 0.5 metres on the negative Z axis. To date, I've tried:

    Code (CSharp):
    1. recoilSequence.Append(gunBarrelObject.transform.DOLocalMoveZ(startPos.z - recoilDistance, recoilTime));
    2.  
    3. recoilSequence.Append(gunBarrelObject.transform.DOLocalMoveZ(-recoilDistance, recoilTime).SetRelative());
    4.  
    5. recoilSequence.Append(gunBarrelObject.transform.DOLocalMoveZ(-recoilDistance, recoilTime));
     
  7. Bazz_boyy

    Bazz_boyy

    Joined:
    May 22, 2013
    Posts:
    155
    Greetings fellow tweeners. sorry to hijack the conversation, I need help with something simple:

    DoLookAt doesn't seem to want to work at the same time as DoMove. I've tried just playing the tweens and putting them in a sequence at the same index. Neither seem to work. Its happy to move but it wont rotate.

    Any ideas why this may be happening?

    Cheerss
     
  8. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    Hey Ben_Iyan, what you are doing is correct if you want to move the cylinder on the Global Axis. But I think you actually want to move it on its Local axis, correct?

    To do that you need to do something like this:


    Code (CSharp):
    1. cylinder.DOMove(cylinder.transform.position + cylinder.transform.forward * -0.5f, 1f ).Play();
    That code moves the cylinder by -0.5 on its Local Z axis. Here's the documentation for Transform.forward

    https://docs.unity3d.com/ScriptReference/Transform-forward.html
     
    Ben_Iyan likes this.
  9. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    192
    @flashframe Thank you! It works perfectly. I would still like to understand why the DOLocalMove doesn't seem to work. Thanks again for your help,
     
  10. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    187
    DOPlay only works the first time.

    I'm calling DOPlay() repeatedly on DOTweenAnimation components and it simply refuses to play more than once. What gives?

    I've tried disabling AutoPlay and AutoKill, nothing works.
     
  11. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    226

    Sorry , I made a mistake with my code. I added too many settings. For those that would like to know the answer, this is it. "Simple and short"

    Code (CSharp):
    1.  
    2.  
    3. public Vector3[] _x = new[] { new Vector3(388.2391f, 294.7322f, 0f), new Vector3(390.8344f, 294.0244f, 0f), new Vector3(392.2f, 291.79f, 0f), new Vector3(390.7574f, 288.6382f, 0f), new Vector3(386.5f, 283.8466f, 0f) };
    4.  
    5. _transform.DOPath(_x, 10, PathType.CatmullRom, PathMode.Full3D).SetEase(Ease.InQuad).SetLoops(-1,LoopType.Restart);
     
  12. jmd01

    jmd01

    Joined:
    Sep 15, 2017
    Posts:
    2
    I have an array of waypoints that I want to adjust using the visual path editor. Is it possible to pass the values into the editor without copying and pasting each one?

    upload_2018-11-23_11-56-10.png
    I can see there is a 'copy to clipboard' option, but I need a 'paste from clipboard' option.

    Thanks
     
  13. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    Is there any way of using a DOJUMP but with sligntly modifications (or use a DOMOVE that does the same)?

    My modifications could be:
    • use an animation curve to animate position instead of a JumpPower, this way we can make some automatic variations to the move
    • or use some kind of random value inside a circle that has it's middle between init point and end point to be set as jumpPower? (I can calculate the jump power from outside dotween but it could be fine to have a DOJUMP with a bool random option to select
    Thanks!
     
  14. WhamBamKazaam

    WhamBamKazaam

    Joined:
    Jun 13, 2018
    Posts:
    6
    Hey folks,

    I recently picked up the Pro version of DOTween. Like what I've seen so far, but for some reason, all my tweens consistently AutoPlay, even if I've deselected AutoPlay in the inspector. I've even tried disabling the DO Tween Animation component(s), but they still AutoPlay somehow. Anyone else having this issue?
     
  15. jcuriel_glu

    jcuriel_glu

    Joined:
    May 26, 2017
    Posts:
    12
    Is there new documentation for the DOTween Animation component? It looks quite different from the version in the YouTube video description.
     
  16. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    34
    Thanks for maintaining DOTween. Just thought I'd share how we're using it -

    ♥ Scriptable Objects ♥
     
    FuguFirecracker likes this.
  17. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    503
    For the Dotween Visual Manager script, it currently only has options for OnEnable,OnDisable.

    For unity canvases this isn't optimized because enabling,disabling canvas elements causes a rebuild.
    Unity recommends disabling only the canvas component to stop rendering the elements.
    Is it possible to add that that to visual manager so when referenced canvas component is enabled, then play the tween again?

    just a suggestion, thanks.
     
  18. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    149
    I'd also like to know if the module system has been documented.

    What benefits does disabling a module provide?

    After upgrading a very old project to a newer version of DOTween, is there any way to identified which modules are in use?

    What happens when a module is disabled? Are certain extension methods no longer available for use by scripts? Should we expect compile errors?
     
    username132323232 likes this.
  19. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    439
    Hello. When I call SetEase(), as in this example, what does the "overshoot" parameter value actually mean?

    Code (CSharp):
    1. transform.DOScale(2f, 1f).SetEase(Ease.OutBack, overshoot: 1f);
     
    Last edited: Dec 4, 2018
  20. michelhabib

    michelhabib

    Joined:
    Mar 12, 2012
    Posts:
    17
    Hello, i got DoTween Pro, and i have a few questions which i couldn't easily find answers to, i hope you can direct me or answer if you know.
    1- I have an object, i intend to place multiple Do Tween paths scripts on them, and play these paths when needed, that is possible right?
    2- I want to move the whole path in edit mode, or select multiple points on the path and move/transform them, can i do that? does that work in case i have multiple path scripts?

    Thank you in Advance
     
  21. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    276
    Hey,
    Im running into reflections issues with dotween Pro with Unity 2017.4.10.
    You've already chimed in through the DemiGiant github issue page (https://github.com/Demigiant/dotween/issues/257) regarding a fix, but that's for regular DoTween, is there a similar fix available for Pro? ( Pro versions differs from the versioning of the non pro )
    Current DOTween is v.1.2.135, and DOTweenPro is v1.0.075.
     
  22. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    215
    Running into an issue that probably has a simple solution. I have a path which I am calling with DOPlay() after an animation completes. However, because the object is at a different location when the scene starts, and is moved by the animation, when I send the DOPlay() message to the object, the object teleports back to the position it was before the animation and then traverses the path from there. Is there a method I can call to update the path before triggering the DOTweenPath? I tried sending the DORestart(true) message to the DOTweenPath but it isn't recalculating, which I saw on one of your threads should recalculate the path based on the current position....
    Relative is checked. I am calling the method from Unity event, bool is checked and set to true. Not sure what is going wrong, can this not be called from events and function as expected?
    I'm really at a loss. This seems like something that is very simple and I am unsure why it isn't functioning as expected. I've spent an entire work day trying just to get this to work.
    Sending the DORestart message to it with true or false doesn't make a difference, same result. The object teleports to the point it was at previously when initially enabled

    Also is there a link to documentation that is in a more standard format? I just want a standard API where I can easily see how things are organized from an object oriented perspective

    Also is there a way to send a message to a gameobject and play a particular path animation by passing it a string of the ID assigned to that path?
     
    Last edited: Dec 7, 2018
  23. GamerST

    GamerST

    Joined:
    Oct 14, 2013
    Posts:
    4
    Hi,guys. I found some odd behaviors in DOTween. Maybe someone is stuck like me. Maybe someone can explain this to me.
    Few days ago, i have question, it's about Sequence and LoopType.Incremental. When i inset some sequences, the LoopType.Incremental not work, it's display as LoopType.Restart. I found a solution is not add DOXXX to sequence directly, instead, use AppendCallBack, then call DOXXX in the CallBack, it works, DOXXX has Increment. But here is a new question.
    i use AppendCallBack like:
    Code (CSharp):
    1. var seq1 = DOTween.Sequence();
    2. seq1.AppendInterval(startInterval);
    3. seq.AppendCallback(()=>{
    4. // do something DOXXX
    5. });
    6. seq1.AppendInterval(endInterval);
    7.  
    When the startInterval is very small like 0f or 0.0001f, the Callback not be called.
    After test a lot functions. i found if i use:
    Code (CSharp):
    1. var seq1 = DOTween.Sequence();
    2. seq1.AppendInterval(startInterval);
    3. seq1.OnStepComplete(()=>{
    4. // do somsthing DOXXX
    5. });
    6. seq1.AppendInterval(endInterval);
    7.  
    use OnStepComplete. the Callback work well.
    but i don't know why this work. Please tell me i'm not in some risk.
     
  24. Pendulum_

    Pendulum_

    Joined:
    Jul 30, 2015
    Posts:
    107
    It appears the DoShakePosition shortcut looks for a camera object and trying to use a transform will not compile. Picture attached.
     

    Attached Files:

    Last edited: Dec 6, 2018
  25. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Im using DOTween Pro to animate some gameobjects. I have two animations on the same object. The first animation, it plays automatically when is activated. I want to play the second animation in a certain moment. Does anyone know how this can be done ?

    Cheers.
     
  26. mbadawi-art

    mbadawi-art

    Joined:
    Aug 24, 2018
    Posts:
    3
    I'm Using DOTween Pro 1.0.075 in Unity 2018.2. Is there a way to specify a rotation to the waypoints of a DOTween path? I want my object to move to a certain position and have a user specified orientation at each waypoint.

    I could add a Rotation Tween each time my object reaches a Waypoint, and get the values from some user specidifed array, but it would definitely be much easier if I could set the waypoint rotation directly in the editor.

    I'm not scared of codign something specific for this, like overloading the editor inerface for manipulating waypoints and changing the path class. Just point me in the right direction if this behavior is at all possible.

    Thanks!
     
    Last edited: Dec 7, 2018
  27. Miguelfanclub

    Miguelfanclub

    Joined:
    Jun 14, 2015
    Posts:
    20
    Assets/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs(52,54): error CS0234: The type or namespace name `PlayModeStateChange' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?

    After a fresh install on 2017.1
     
  28. badSkin

    badSkin

    Joined:
    Jan 10, 2018
    Posts:
    6
    I just imported DoTweenPro in Unity.2018.2 and get this:

    Assets/Demigiant/DOTweenPro/DOTweenTk2d.cs(217,43): error CS0246: The type or namespace name `tk2dTextMesh' could not be found. Are you missing an assembly reference?
     
  29. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    922
    @Izitmee
    Can i run tweens in editor mode (not playing)? I tried but tweens doesnt happen
     
  30. magic92

    magic92

    Joined:
    Feb 8, 2016
    Posts:
    2
    Hi, @Izitmee! I have the same problem, that @zacksawyer said.

    I twist the cube through DoRotate 90 degrees left, right, up and down. Left, right, everything is ok. Up or down - spin correctly once, come back, again spin in the right direction 1 time and so on ad infinitum. Tell me how to do it right.
     
  31. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    922
    Hi there,

    I see a lot of lambda functions in DOXXX which generates a lot of garbage, how can i avoid that?
     
  32. I_Dont_See_Sharp

    I_Dont_See_Sharp

    Joined:
    Jan 30, 2018
    Posts:
    1
    Has anyone had the issue where they create a path within the path editor of DOTween and later the path has changed? I created a few paths. Went to play the scene a day later, and noticed all the paths were off. They were completely fine the previous day, and no adjustment was made. The Path itself was "good" but the positioning of it was wrong.

    What I mean is, let's say I created an arc path that started from the middle of my scene. It somehow moved over so it started on the left side of the scene instead. That is, if X was 250, it was now 150.

    What would cause this?
     
  33. atk_defender

    atk_defender

    Joined:
    Jun 26, 2018
    Posts:
    8
    DOTween has bugs in text and string.

    string text.text="432";
    text.DOText("4321421fdsf", 5f);
    //“1421fdsf” appear smoothly.

    string text.text="4321421fdsf";
    text.DOText("432", 5f);
    //“1421fdsf” disappear not smoothly.
     
    Last edited: Jan 10, 2019
  34. bighead1983

    bighead1983

    Joined:
    May 25, 2018
    Posts:
    1
    Hi, I'd like to use Dotween path to control the relative path for the drop items or UI numbers, but we found that there is no use in "Relative" ticked. I found a tips about this http://forum.demigiant.com/index.php?topic=1077.msg1768, but we found it is no use in
    DORestart(true);
    Can you give some advice for us ?
     
  35. Alejandro-Martinez-Chacin

    Alejandro-Martinez-Chacin

    Joined:
    Oct 15, 2013
    Posts:
    38
    Timboc that's massive, very cool!
    Did you that all from scratch? I found myself creating often properties for Monobehaviors that end up being fed to a local DOTween object... mostly because TweenParams are not serializable.
    Same issue with DOTweenAnimation... if I wanted to create a DOTweenAnimation on the fly it's complicated because there is not meant to out of the box to just have the 'animation data' and create tweens on the fly.
    Great idea, will pursue a similar approach.
     
    Timboc likes this.
  36. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    34
    Unless something changed recently, as far as I know this isn't supported. From memory it's possible (i.e. I did it once) to alter DOTween code to support it but I think it doesn't necessarily work in all situations which may be the reason it is like it is.
     
  37. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    34
    Thanks Alejandro! Yea it's pretty much all from scratch. The serialization of the data is quite easy. The main issue I ran into was making tweens that are interrupt-able and animate from their current position. when you create a tween it stores it's initial value at the time of creation and there's no way to runtime modify it that I know of. So at the moment, the tween is created on the frame it's needed (which is a shame but so far not too bad perf-wise). I also have a function that caches the initial scene value so you can e.g. put a UI element in the correct place, set the hide animation to be y=-1000 or something and the auto-show will move it back into the authored position. For previewing in-editor I use an asset called More Effective Coroutines though I think you could just use Editor.Update. Good luck! Please report back if you end up doing something similar.
     
  38. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    185
    Sorry if this is obvious, but it is really hard to search due to the involved search words:

    Example of my problem:

    I want to know the (optimal) C# to make a transform spin 10 times (3600 on Y) AND during this have a single, long ease In/Out.

    As short as I could write it :) How?!? Combo of Loops and Relative and or writing 3600 or .. Cannot make it freaking WORK!
    (have pro)
    Thanks!
     
  39. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    There are a lot of ways to do it, but I'd do it like this:

    Code (CSharp):
    1. transform.DOLocalRotate(new Vector3(0,3600f,0), 10f, RotateMode.LocalAxisAdd).SetEase(Ease.InOutSine).Play();
     
  40. DavidJares

    DavidJares

    Joined:
    Dec 18, 2016
    Posts:
    38
    Hello. I am a happy Dotween user. I would need some help - I am trying to use the static editor functions :
    static DOTweenEditorPreview.PrepareTweenForPreview(bool clearCallbacks = true, boolpreventAutoKill = true, bool andPlay = true)
    static DOTweenEditorPreview.Start(Action onPreviewUpdated = null)
    static DOTweenEditorPreview.Stop()

    I cannot access these from script. I tried to search for the correct namespace to import, but had no luck . I cant have a look into the dll. Am I doing something wrong / what am I missing here ? I would like to trigger the previewing of animations from my own components. For any help, thank you very much in advance :) Happy tweening
     
  41. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    185
    Interesting, thanks :D
     
  42. Cris_2013

    Cris_2013

    Joined:
    Nov 25, 2017
    Posts:
    16
    Hi, many thanks for this wonderful asset, it really changed my project.
    I'd like to request a shortcut for the Light component, would it be possible to add DoRange, please?

    Many thanks!
     
  43. DjEmix

    DjEmix

    Joined:
    Feb 7, 2013
    Posts:
    11
    Hello!! We are using Pro versión and the Do Tween Path.
    We have a question about events, how can I get an event when my object pass throught a waypoint.
    This is, I want that the path call an event when my object pass in each waypoint.
    Is this possible?
     
  44. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    Code (CSharp):
    1.  
    2. void Start() {
    3.     transform.DOPath(waypoints, 1).OnWaypointChange(MyCallback);
    4.  }
    5.  void MyCallback(int waypointIndex) {
    6.     Debug.Log("Waypoint index changed to " + waypointIndex);
    7.  }
     
  45. Cris_2013

    Cris_2013

    Joined:
    Nov 25, 2017
    Posts:
    16
    Would it be possible to add DoRange shortcut for the light component. please?
    Thanks
     
  46. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    185
    Just a little feedback here.. I am working daily with the Editor/Pro.. And one thing that keeps annoying me, is just a small thing:

    It's the visual focus! Whats really important to me is that I don't change the wrong "entry", like change a number on a fade, when I thought it was the move..

    So this information is the one I am looking for mostly when working / tweaking things.

    And the information / dropdown where this is written is just significantly smaller / less "eye catching" than for example "Add Manager".. which is something I not do that often, really.

    EVERY time someone has to read that UI, they will be trying to understand weather this is a Fade, A Move, a.. so this is VERY IMPORTANT INFO.. and it would be nice to have that at least in another color, like blue or something.

    Bigger letters would be nice.

    It's also written in the headline, of course, but that is after the Logo, which is a mess for the eye: Read Logo, Read Type.. Look down, read Type again..

    Color coding / icons would be superb.

    But at least try and make Type more Eye Catching than the rest, and have the info only once and not after a Logo with text and colors.

    It is after all the indication of what this element does, that you look for when you come back to this in the inspector, and often times there will be many of these, please make it clear what each does ;)!
     

    Attached Files:

  47. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    81
    Hello,
    We are trying to make our interval time parametric. In other words we want to increase the frequency of "hearthbeat" effect according to fill amount (remaining time).

    We tried below but i gave us a fixed coefficient instead of a parametric one.(1f * GetComponent<Image>().fillAmount)
    Code (CSharp):
    1.    GetComponent<Image>().DOFillAmount(0, 10f).SetEase(Ease.Linear).OnStepComplete(() =>
    2.         {
    3.         });
    4.  
    5.         transform.DOScale(1.2f, 1f * GetComponent<Image>().fillAmount).SetLoops(10, LoopType.Yoyo);
    6.          
    7.  
    Best Regards
     
  48. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    36
    HI

    I'd like to ask, what should be the proper way of handling destroyed objects while tweening?

    Let's say I have this code:
    Code (CSharp):
    1.    
    2.     private void Start ()
    3.     {
    4.         DOTween.Sequence().AppendInterval(4).AppendCallback(ArbitraryMethod);
    5.         Destroy(gameObject, 2);
    6.     }
    7.  
    8.     private void ArbitraryMethod ()
    9.     {
    10.         Debug.Log("Here");
    11.     }
    12.  
    So, I use example Sequence to call ArbitraryMethod after 4 seconds, but I destroy the object after 2.
    I have Safe Mode turned on, so I get a console message:
    DOTWEEN ► Tween startup failed (NULL target/property - ): the tween will now be killed ► ...

    So, is this something I should worry about in the released version or this is perfectly fine while Safe Mode is On?

    I know I can get a reference to the sequence and then Kill it in OnDestroy, something like this:
    Code (CSharp):
    1.     private void OnDestroy ()
    2.     {
    3.         DOTween.Kill(_referenceToAboveSequence);
    4.     }
    5.  
    But I'd just like to know if there is any "Automatic" way to handle Tween Calls to destroyed objects without worrying about warning messages from the engine?
     
  49. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    This is what the documentation has to say about it:

     
  50. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Hi, I have an issue with Dotween + DoozyUI, When i add the component DoTweenAnimation and set it to Fade, then set it to FROM 0. When i load the menu page i am on all my buttons are actually on!

    Also can someone explain what auto kill actually does?

    On top of that when my window is disabled i want all my tweens and objects to go back to their starting state, is this possible with DoTween? I tried Do Restart but it seems to not work on some items(Most of the are Canvas Groups)

    Thanks