Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

DOTween (HOTween v2), a Unity tween engine

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

  1. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    WEATHER REPORT!

    I'll be travelling for the whole day now, so I will be un-supportive until Saturday or maybe even Sunday. See ya!
     
    gjf likes this.
  2. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    Have trouble to get DOAnchorPos working with an Text. I attached the Score effect to an figure from my game thats moving down and Spawn the Text if the Figure gets Completed. Then use DOAnchorPos to move the text to the Score Text from the UI Top Left. It dont works like it should be only if the figure gets completed on Top row.
    If the figure more middle or bottom it only moves right. Any suggestions?
     
  3. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    402
    Would it be possible to add the TextMeshPro methods to TextMeshProUGUI? as these are missing at the moment :(

    cheers

    N
     
  4. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    DOTWEEN PRO UPDATE 0.9.160
    • DOTweenAnimation: now works also with TextMeshProUGUI
    • Scripting: new shortcuts for TextMeshProUGUI

    @puzzlekings Wooops! Sorry I'm a TextMeshPro noob, and I tried it the first time only to implement the shortcuts. Didn't realize there was a TextMeshProUGUI thing :B I just came back to Rome and ran to implement it, so here they are :)

    @meapps DOAnchorPos simply tweens the anchorPosition of an object, so if the end result is wrong I suppose there must be something wrong in the end value you set? Did you try to set it directly to see if something different happens? Now I'm kind of slammed after 10 hours of travel, but let me know, and tomorrow I'll check it out better.
     
    Crazydadz likes this.
  5. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    402
    You're a star!
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Yey ^_^

     
    neonblitzer and Dean-Kuai like this.
  7. boolean01

    boolean01

    Joined:
    Nov 16, 2013
    Posts:
    90
    Hi there

    Dumb question but - did the default easing type on DOTween change? I upgraded my version and now instead of my objects using DoMove where the speed goes 'slow-medium-slow', they just go 'medium-slow'. I found I had to add ".SetEase(Ease.InOutQuart)" on everything to get the same effect.

    Am I going crazy or did this change?
     
  8. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @boolean01 Hi! Not dumb at all! And yes, the default ease changed to OutQuad instead than InOutQuad (which was the previous one), a while ago. But I also added a very easy way to choose the default ease without having to write it via code. Just open Tools > DOTween Utility Panel, and in the Preferences Tab you'll be able to set the default ease :)

    dotween_utilitypanel_preferences.png
     
  9. boolean01

    boolean01

    Joined:
    Nov 16, 2013
    Posts:
    90
    Brilliant! Thanks mate :)
     
  10. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee

    Is it possible to calc the waypoints for the DoTweenPatch with the distance of the other gameobject?
    DOAnchorPos i cant get it working...
     
  11. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee

    Is it possible to calc the waypoints for the DoTweenPatch with the distance of the other gameobject?
    DOAnchorPos i cant get it working...

    example for DOAnchorPos:





    Score should move up to the top ScoreText.
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    DOTWEEN UPDATE 1.0.470
    • NEW: You can now choose where to store DOTween's Settings (using DOTween Utility Panel)



    @meapps Sending a new update to the Asset Store and then I'll check anchorPos
     
  13. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @meapps I made some tests, and DOAnchorPos works perfectly. Did you make that test I asked you? To set the end value directly without a tween, in order to understand if you're simply setting the wrong endValue? If you did and you still have problems, try to replicate those issues in a small barebone project and send it to me, so I'll check it out.

    About your DOPath question, I'm sorry but I didn't understand what you were asking. Can you explain me better?
     
  14. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Firstly, I've been using DOTween for a couple months now and love it!

    I am however running into a possible bug or I'm just not setting this up properly. I have a transform DORotate tween that uses SetRelative. From what I understand of SetRelative, it's supposed to add the end value to the tranform's current rotation.

    Code (CSharp):
    1. transform.DORotate(new Vector3(0,0,20f), 3f).SetRelative();
    I would expect this to add 20 to the z axis. What happens though is the tween rotates the current transform's rotation plus the end value. So if my transform's z axis was 40, the tween would rotate to 100 instead of 60.

    SetRelative doesn't act this way with DOMove, so is this a bug?
     
  15. XenoBits

    XenoBits

    Joined:
    Aug 28, 2014
    Posts:
    27
    Hello,

    First thanks for this super neat plugin! It made me save a lot of time except today :p

    I've just encountered a major issue on WP8, I did not found anything related in the last few pages of the thread so I hope it was not already reported.

    I've been using it for month on my project and decided this week to update my very old version that I had manually imported from the website to the one available in the asset store.

    Everything went fine, I exported the project to WP8, tested it properly, found no issue then posted the update.

    The certification failed "Your game do nothing"

    What? I tested again the app it was running fine how could it be possible? After a long time investigating I found a way to reproduce the issue, if I set the WP8 project to Release configuration instead of Master I will indeed encounter a Null pointer exception from DoTween at the start of my game that will prevent it to go further on.

    Now I think this is pretty serious as it may happen on any game using the latest version of DOTween, and it's really hard to spot as the Master version will behave properly if you test it from Visual Studio or Unity.

    I tried to find an easy repro on a new project, here it is:
    1. Create a new project
    2. Import DoTween
    3. Add a cube or anything, attach a new script
    4. In the script just do a tween in the Start method ( e.g. this.transform.DOLocalMoveY(5f, 3f); )
    5. Export the project to WP8
    Now the tricky part, Unity create a new configuration for the Windows Phone 8 project, named "Master", that you have to use in order to post your app.
    • If you test the project in Master configuration it will run as expected, cube will move.
    • If you test the project in Release configuration you will see the exception be thrown, cube will NOT move.
    • And if you build the project in Master configuration and deploy the .xap binary file using Microsoft application deployment tool, the exception will be thrown (silently) while executing the game and the cube will NOT move.
    Here is the log I have, hope I have been clear enough and that it will help:
    Code (CSharp):
    1. Exception: Object reference not set to an instance of an object.
    2. Type: System.NullReferenceException
    3. Module: DOTween
    4. InnerException: <No Data>
    5. AdditionalInfo:<No Data>
    6.    at DG.Tweening.ShortcutExtensions.DOLocalMoveY(Transform target, Single endValue, Single duration, Boolean snapping)
    7.    at CubeTest.$Invoke0(Int64 instance, Int64* args)
    8.    at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @pxlweaver Glad you like it :) Gonna investigate that tomorrow!

    @XenoBits Agh! That is an issue introduced by WP8.1 (everything works with WP8) that I'm trying to fix since a while, but I thought that in the meantime the Master build was a viable workaround. If that doesn't work either it's dramatic.
    Please check out this thread to read more about it (it's a Unity issue with Vector2/3/4 - but also Color - classes, where a cast which is completely legit instead fails). Also, please vote here to make Unity work on it faster.
    That said, I'm now gonna try to find a solution as quickly as possible, even if in spite of many tries I didn't succeed until now.
     
  17. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    When the global ease is set to something other than linear, this below sequence is definitely not Linear. I can see it speed up at the start and slow down at the end:

    m_Sequence = DOTween.Sequence ();
    m_Sequence.Append (this.transform.DOMove (toVector, speed));
    m_Sequence.SetEase(Ease.Linear);
    m_Sequence.Play ();

    However, if I go into the DOTween Utility Panel and set the default ease to Linear, the above code IS linear.
    Finally, if I set the above to m_Sequence.SetEase(Ease.InOutQuint), the easing is actually InOutQuint, as it should be, overriding the global setting properly.
     
  18. XenoBits

    XenoBits

    Joined:
    Aug 28, 2014
    Posts:
    27
    Thanks for the quick reply! I voted and hope this will be fixed soon by Unity.

    Meanwhile I'll keep an eye on this thread and stick to my old version that is totally fine for my needs.
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @timothyallan When you apply an ease to a Sequence, it is applied on top of its contents. For example:
    • if both the Sequence and the nested tween have a Linear ease, then the animation will look linear
    • if the nested tween has an OutQuad ease and the Sequence has a Linear one (or none, since Linear is always the default for Sequences), then the animation will be outQuad
    • if the nested tween has a Linear ease and the Sequence has an OutQuint ease, then the animation will be OutQuint
    • if the nested tween has an non-Linear ease and the Sequence too has a non-Linear ease, the two will combine
    In general, Sequence easing is a bonus feature that can be used to apply additional animation smoothing to a whole series of nested tweens, but doesn't have much sense when there's only one nested tween. Whew, long explanation :D

    @XenoBits I might have an idea on how to solve it. Sent a test copy to Rafal (who's helping me with WP8 tests since I don't have it), and we'll see.
     
  20. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    Okay, thanks that clears things up! I had read the docs a few times, and they say if I apply Ease to a sequence "the ease will be applied to the whole Sequence as if it was a single animated timeline", which I assumed meant it would apply & replace the Ease of the timeline, not be appended on top of any existing ones. Got it now :)
     
  21. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    for DOTween Pro, will it supports NGUI shortcut ?
     
  22. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    420
    Hello, there is a problem with dotweenanimation while using relative movement and switching "TO" to "FROM" . It works just like relative isn't ticked.
     
  23. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @yuewahchan I don't plan to, since I don't have NGUI. But I will think of that (by the way, you obviously can still tween NGUI stuff with the generic way in the meantime).

    @Meceka Ouch! Investigating that now!
     
  24. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Meceka I can't seem to replicate it: everything works here. Can you create a sample package that replicates your issue and send it to me, so I can check it out?
     
  25. JayJennings

    JayJennings

    Joined:
    Jun 24, 2013
    Posts:
    184
    Sorry I didn't read all 25 pages of posts to see if it's already answered. but how is DOTween pronounced?

    Due to the colors of the logo I'm assuming doo-tween, but since I make tutorial videos I'd like to make sure so I don't say the wrong thing.

    Jay
     
  26. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
    Help me please. After I updated to version 0.9.160 DoTweenPro I began to receive 10 errors.

    Version 0.9.150 of these errors were not. What can I do to eliminate them?
    Text Mesh Pro 0.1.44 I have in the project.

     
  27. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    420
    Hello, I have this issue with a gui button. Test it with a gui button when autoplay, relative is selected, and it comes "FROM" a vector3. If you can't reproduce I will send you a package.
     
  28. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    402
    The version of TMPro on the Unity Asset Store does not support UGUI

    This feature is in the next betas 0.1.46 on Unity 4 and 0.1.5 on Unity 5. If you contact Stephan on the TMPro forums then he may be able to give you access to these.

    HTH

    N
     
    xcube likes this.
  29. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @J. A. Whye Good question. It should be pronounced doo-tween as you assumed, even if I often pronounce it wrongly (dot-tween).

    @xcube It seem that you have an older vesion of TextMeshPro, which doesn't have the TextMeshProUGUI class (used for TextMeshPro objects inside the new UGUI system). Update TextMeshPro and everything will work.
    EDIT: I read @puzzlekings' comment after writing this. Ouch, I got TextMeshPro from Stephan's forum, and I didn't know that TextMeshProUGUI is not yet implemented. I'm gonna upload to the private forum a version that ignores it in a few minutes
     
  30. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    xcube likes this.
  31. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Meceka I managed to reproduce it with a UI button. It seems it's due to Unity not having yet initialized a button's transform when the tween starts. I think I know how to fix it and will get on it asap.
     
  33. MetallimaN

    MetallimaN

    Joined:
    Mar 11, 2015
    Posts:
    20
    Hi,
    Is there a way to reference a visually designed tween in code? What I want to do is check the ElapsedPercentage() method and after a certain point, speed up the objects movement. My problem is that I can't figure out how to access the tween that I created visually.
     
  34. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @MetallimaN Hi,

    There is no direct way, because you might have more than one tween on the same GameObject. But if you give your visual tween an ID, you can use TweensById to get a list of all tweens with the given ID.

    EDIT: Otherwise, you can also use TweenByTarget (using the gameObject as a target, since that's what visual tweens assign, contrary to script shortcuts that assign the actual target like transform/material/etc)
     
  35. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee have you tested or checked anchorPos ?

    I got working different random score text colours as an effect;)
     
  36. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @meapps Yes ;) Let me know, and cool (about the text colors) :)
     
  37. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    You added DoColor too the UI Text. I created a list with the colours randomized the color and used DoColor

    I will send you an example with the AnchorPos issue.
     
  38. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,146
    I'm trying to make a sequence where a ship moves over a few tiles. I can't get it to move smoothly from tile to tile and it keeps slowing down when reaching a node and then speeds up to move to next one. I've also messed around with the .SetEase() but can't seem to find the right combination.

    Ideally I want the ship to speed up on its way to the first node, and then stay at a constant speed to the next nodes(s) and then slow down on its way to the last node.

    [EDIT] Found my mistake. I was attaching .SetEase() to the end of the Append() rather than to the actual tween (within the append) *facepalm*

    Code (CSharp):
    1. Sequence seq = DOTween.Sequence();
    2. seq.SetEase(Ease.InOutQuad);
    3. for (int i = 0; i < path.Count; i++)
    4. {
    5.     seq.Append(transform.DOMove(path[i].position, GameGlobal.Instance.ShipMoveSpeed).SetEase(Ease.Linear));
    6.     seq.Join(transform.DOLookAt(path[i].position, GameGlobal.Instance.ShipMoveSpeed * 0.3f));
    7. }
    8. seq.OnComplete(OnMoveCompleted);
     
    Last edited: Apr 14, 2015
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Leslie Young Glad you found the issue in the meantime, and sorry if I was late :)
     
  40. Antipirina

    Antipirina

    Joined:
    Aug 7, 2013
    Posts:
    18
    Hi there!
    I was wondering if I could change the FPS.
    I need to lower it to 1FPS as I'm tweening a value and sending it to a function and I need it to be one second at a time.
    Or is there any way if I use a repeatinterval that seeks in the tween at a certain second and send a value to the function every second.
    Thanks!
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hi @Antipirina!

    Mhmm... instead of a tween, you could use DOVirtual.DelayedCall, and do something like this (I hope there are no errors, because I can't test it now):
    Code (csharp):
    1. void Start
    2. {
    3.    // Call MyMethod 10 times, once every second
    4.    DOVirtual.DelayedCall(1, MyMethod).SetLoops(10);
    5. }
    6.  
    7. // Increase the value directly inside your method
    8. void MyMethod
    9. {
    10.    // Increase the value
    11.    myFloat++;
    12.    // Do something
    13. }
     
  42. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Antipirina Also, you could instead use the EaseFactory.StopMotion and just check if the value has increased or not, since that will happen only every one second if you set the FPS to 1.
    Code (csharp):
    1. // Send myFloat to 10 in 5 seconds
    2. DOTween.To(()=> myFloat, x=> myFloat = x, 10, 5)
    3.    .SetEase(EaseFactory.StopMotion(1, Ease.Linear))
    4.    .OnUpdate(()=>MyMethod(myFloat));
     
  43. Antipirina

    Antipirina

    Joined:
    Aug 7, 2013
    Posts:
    18
    Thanks for the fast answer!
    But I need to use the tween to send a "position" of the value range I put in.
    My actual use: I'm using a tween function to increase a population from one point to another along the whole game, but I want to update it every second. Any other suggestion?
    (wait! I haven't seen you last answer yet)
     
  44. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Any luck investigating the possible issue with the DORotate SetRelative thing?
     
  45. Antipirina

    Antipirina

    Joined:
    Aug 7, 2013
    Posts:
    18
    @Izitmee : I can't find the EasyFactory package. What is the path to import it?
     
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @pxlweaver Ooops apologies, I forgot! That was a bug indeed. Here's an update that fixes it :)

    @Antipirina It's in the DG.Tweening namespace (EaseFactory, not EasyFactory) so you should have it by default if you're using a tween. Maybe you have a version older than 1.0.445, which is when EaseFactory was implemented? Grab the one attached here :)
     

    Attached Files:

  47. polygonline

    polygonline

    Joined:
    Apr 15, 2015
    Posts:
    8
    Are you plan playmaker support in the pro version ?
     
  48. Mr_Cad

    Mr_Cad

    Joined:
    Dec 7, 2013
    Posts:
    27
    Hi, I'm having a serious issue whenever I'm using DOTween in a loop

    Code (CSharp):
    1.  
    2. public IEnumerator MoveTiles()
    3. {
    4.         for (int y = 0; y < GameUtils.BOARD_HEIGHT; ++y)
    5.         {
    6.             for (int x = 0; x < GameUtils.BOARD_WIDTH; ++x)
    7.             {
    8.                 Tile tile = m_tiles[x, y];
    9.                 m_tiles[x, y].transform.DOLocalMove(pos, duration).OnComplete(()=>OnTileFinishMovedOut(tile));
    10.             }
    11.         }
    12. }
    13.  
    I noticed whenever OnTileFinishMovedOut(tile) being called, it will only receive the last object of the loop.
    How am I supposed to really make sure OnTileFinishMovedOut(tile) the tile that passed in really that correct tile?

    I'm not sure whether is it because I'm using coroutine way to call the method?
    If so then what's the solution?
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Mr_Cad That is related to coroutines indeed. Check out this article in the FAQ

    @polygonline I was actually thinking about that, but I don't know PlayMaker. Will check some guide and see if I can make it.
     
  50. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    DOTween Pro update 0.9.180

    New Features
    • DOTweenAnimation: tweens the rectTransform.anchorPosition instead than the transform.position when using Move on UGUI elements (more performant)
    • DOTweenAnimation: added DORewindAndPlayNext action
    Bugfixes
    • DOTweenAnimation: fixed "Move" relative FROM tweens not working correctly with UGUI elements
    • DOTweenAnimation: fixed DORestart action restarting only the first tween

    @Meceka Fixed! :)
     
    Last edited: Apr 15, 2015
    Meceka likes this.