Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

DOTween (HOTween v2), a Unity tween engine

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

  1. Alejandro-Martinez-Chacin

    Alejandro-Martinez-Chacin

    Joined:
    Oct 15, 2013
    Posts:
    93
    Hello there, just a few pointers on this as I kinda out of laziness do a lot of in-editor animation stuff: no compiling, can preview them directly (the main benefit for me), etc.
    There are a couple of ways to call the DOTweenAnimations for the GUI, however a couple of points:
    • I have had issues with DOTweens without ID, so in your stack of tweens make sure to have all of them with an ID. I usually go the extra mile and create a 'DOTween' empty game object and start adding 'DOTween animation groups' as children, putting the ID name the same as the gameobject's name that holds the DOTween's series of animations. These DOTweens instead of 'self', they target the specific objects it's supposed to animate.
      • DOTweenProposedHierarchy.png DOTweenSameIDs.png
    • If the DOTween is to be called manually and several times (one of the main benefits of DOTween, since the animations are basically "cached"), deselect both AutoPlay and AutoKill
    • Get the tweens themselves with script and call the function you want (PlayForward, PlayBackwards, Restart, etc) but on ONLY one of them, this will make it trigger all the ones in the object (I think this is undocumented, I just found out). The main DOTweenAnimation gameobject component has an interface for that.
    • Or use Unity Events (may favourite way as it allows for binding/un-binding in-editor) and drag and drop the game object and call the functions there. For example, unity 'buttons' have an event 'OnClick' ready to use, so you can call the animation every time the button is pressed
      • DOTweenAssignmentViaUnityEvents.png
    I use this so much that I went ahead and did wrapper managers, tools, etc around it but all based on the series of bullet points above. It's basically to get around the somewhat UX harsh nature of the GUI Inspector, but make no mistake, I find it really powerful and quick to do playful and fancy animations with ONLY the GUI version and very minor "High Level" scripts that call specific UnityEvents at the right time.
    DOTweenManagerAndEditorWindows.png

    Hope this all helps.
    Edit: typos and somewhat unclear phrase. Also, make sure to click on the tiny images, put them as thumbnails for the sake of not making it a huge post.
     
    farazk86 likes this.
  2. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    I have an object that grows by increasing the scale over time. To add to the effect I added to the loop to rotate 15 degrees each iteration of the loop. It's just firing a DORotate. all of this is in a coroutine. I'm under the impression that the rotation may not be over once the coroutine has ended. I could be wrong there. I don't think I can check for an OnComplete as I just keep hitting the game object with DORotates. Does anyone know if I can ask if there are any active tweens on a given target? Or if in fact the coroutine has exited then my tweens must have finished? Just looking for a good way to fire an event when I am sure the animation is over.
     
  3. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    I always recommend to never use tweens inside a coroutine.
    While it may be done, I have yet to encounter a use-case where it makes sense to do this.
    DOTween provides an ample API to control one's tweens directly without the use of an extraneous coroutine.

    OnComplete() is the answer. If you are having problems using OnComplete, then you have problems with the implementation.

    Post some code, I'll try to help you out.
     
  4. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    hey thanks!
    the loop:
    growthTime is 1.25 sec
    Code (CSharp):
    1.  while (currentTime < finishTime)
    2.             {
    3.                 //Update scale
    4.                 scale = 1f - ((finishTime - currentTime) / m_growthTime);
    5.                 scale = m_startScale + (scale * deltaScale);
    6.  
    7.                 //Apply it to the game object
    8.                 gameObject.transform.localScale = Vector3.one * scale; // so I want to scale at different rates. so I can probably not scale against v.one
    9.                 yield return null;                             // I would love to turn this into a dotween so I could add easing. Look below!
    10.  
    11.                 gameObject.transform.DOLocalRotate(new Vector3(0, 15, 0), m_growthTime, RotateMode.LocalAxisAdd).SetEase(Ease.OutElastic);
    12.                 //yield return new WaitForSeconds(0.1f); // Can use this to lessen impact on fps
    13.  
    14.                 //Update time
    15.                 currentTime = Time.realtimeSinceStartup;
    16.             }
     
  5. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Does this help?

    Code (CSharp):
    1. using DG.Tweening;
    2. using UnityEngine;
    3.  
    4. namespace FuguFirecracker
    5. {
    6.     public class Scalerator : MonoBehaviour
    7.     {
    8.         private void Start()
    9.         {
    10.             ScaleThis(CalculateSize(), CalculateDuration());
    11.      
    12.         }
    13.  
    14. // subsequent tweens will scale to what ever size you specify and at whatever rate
    15.         private void ScaleThis(Vector3 size, float duration)
    16.         {
    17.             transform.DOScale(size, duration).OnComplete(() => ScaleAtDifferentRates(size));
    18.         }
    19.  
    20. // will happen DURING the tween, not applied to subsequent tweens
    21.         private void ScaleAtDifferentRates(Vector3 size)
    22.         {
    23.             var duration = 1f;
    24.             transform.DOScale(size, duration).OnUpdate(() => duration = CalculateDuration());
    25.         }
    26.     // will happen DURING the tween, not applied to subsequent tweens
    27.         private void ScaleToDifferentSizes(float duration)
    28.         {
    29.             var size = Vector3.one;
    30.             transform.DOScale(size, duration).OnUpdate(() => size = CalculateSize());
    31.         }
    32.  
    33.  
    34.         private Vector3 CalculateSize()
    35.         {
    36.             var size = new Vector3();
    37.             // do your scaling calculations here
    38.             return size;
    39.         }
    40.  
    41.         private float CalculateDuration()
    42.         {
    43.             var duration = 0f;
    44.             // do your time calculations here
    45.             return duration;
    46.         }
    47.  
    48.     }
    49. }
     
  6. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    @FuguFirecracker I will play around with it, but the main purpose was to know when the DOLocalRotate had finished. What is your objection to the coroutine btw?
     
  7. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    So I just added this after the loop:

    Debug.Log("Am I still tweening? :" + DOTween.IsTweening(gameObject));

    and I got 92 false log entries, so I think it's safe to say that the tweens end when the loop does.
     
  8. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    The main purpose of the code I posted was to illustrate that you don't need to use a coroutine to do anything.
    DoTween uses it's own coroutines and can update itself using the OnUpdate() chained method.
    You don't need a coroutine to update the information.

    Read through this thread. It's full of people uninformedly using coroutines to control DoTween and asking why their code doesn't work.

    The short answer is: Because now you've got 2 coroutines (hidden from you, dotween starts it's own coroutine automatically) to do the one thing that you only need dotween to do and good luck trying to control both or getting a predictable result. whew! that was a mouthful.

    Uh ... you should be able to Swap out 'Scale' for 'Rotate' in the code example.
    I have no idea what your variables represent nor from whence they come, so I can't write that for you.
    [well, I have SOME idea based on the names]

    In summary:
    Don't use a coroutine.
    Use OnComplete to know when DOLocalRotate has finished.
    Use OnUpdate(). to update any dynamic variable you need to calculate during the life of your tween.

    If you post a trimmed down monobehavior indicative of the goal you're trying to accomplish, I'll try to help you get it working.
     
  9. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    So I get what you're saying, the scale loop was a piece of code that came from an asset. I guess I never thought about removing the loop and just chaining a DOScale and DORotate together. I will try and look at it from a different perspective. Thanks Fugu! I also appreciate your willingness to help.
     
    FuguFirecracker likes this.
  10. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Dotween does not tween gameObjects.
    It tweens component values on those gameObjects.
    Your "test" will always return false.
     
  11. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Tweens? Together!? That sounds like a prime candidate for a Sequence() ! ;)
     
  12. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    Yes sir, I had to change it to gameObject.transform to get a proper reading
     
  13. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    111
    You won me over.

    Code (CSharp):
    1. var mySequence = DOTween.Sequence();
    2. var degrees = 3000 / ActualEndScale;
    3. mySequence.Append(transform.DOScale(ActualEndScale, GrowthTime))
    4.                 .Join(transform.DOLocalRotate(new Vector3(0, degrees, 0), GrowthTime,RotateMode.FastBeyond360).SetEase(Ease.OutElastic))
    5.                 .OnComplete(() => After());
     
    FuguFirecracker likes this.
  14. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    I feel like you've made fantastic progress here ;)
     
    Abended likes this.
  15. Liens

    Liens

    Joined:
    Feb 2, 2012
    Posts:
    49
    Hello, is there a way to use the Sequences feature with DoTween Animation script (from DoTween Pro)?
     
  16. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    What do you want to achieve?
    Do you want to write code? Do you want to use the pro GUI? Or is it that you want to combine the two ?

    If you know how to write Sequences, you don't need the GUI.
    If you're using the GUI, you don't need to write your own Sequences.

    How to work with Sequences here

    I know the search tools on this forum leave a lot to be desired, but interacting with DOTweenAnimation components from C# is here
     
  17. Liens

    Liens

    Joined:
    Feb 2, 2012
    Posts:
    49
    Thanks, the second one, using the GUI for sequences. Is the equivalent in GUI just adding more and more DOTweenAnimation components and compounding the delay times?
     
  18. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    I do believe that one adds the one DoTweenAnimation componet, and then add successive tweens in that component. There should be an "Add Tween" button, if I'm not mistaken. -or something like that- I don't use the GUI.
     
  19. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    151
    hi, I want to make something like using dotween. How do I do it?
     
  20. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Step 1 is learning.
    Step 2 is trying.
    Step 3 is asking for help.

    Step 0, of course, is to not expect somebody to watch a 20 minute video and then create a private lesson for you.

    Having said that, I am available for private lessons starting from $2.00 a minute. First 5 minutes free.
    DM for details ! ;)
     
  21. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    20
    Image component's color animation can't preview in Editor. When i click the play button on DOTweenAnimation Inspector, there's nothing happened. It has no problem in running mode. But it can't preview unless I drag the Game View to make it size changing.
     
  22. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    whatDoYouExpect.png
     
  23. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    151
    step 4 if don't know the answer don't bother replying show me ur published steam page or itch.io. I just wanted to use dotween to do the same. I already know how to do it the regular way. My friend just recommended that dotween is faster. Don't troll.
     
  24. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    I'm going to press the "ignore" button now; I shall never ever see whatever you respond with, you ridiculous child.
     
  25. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    151
    a kid telling someone else a kid what a joke. show me ur games man and something u made. got some jam games at least?
     
  26. pradf4i

    pradf4i

    Joined:
    Nov 7, 2017
    Posts:
    34
  27. Levr01

    Levr01

    Joined:
    Jun 6, 2017
    Posts:
    26
    This message appears randomly. The message does not refer to any line of my code, but I can't get to the code specified in the message, this is a closed part of the code. What should I do ? Is this another bug ?

    Look rotation viewing vector is zero
    UnityEngine.Quaternion:LookRotation(Vector3, Vector3)
    DG.Tweening.Plugins.Core.SpecialPluginsUtils:SetLookAt(TweenerCore`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/Core/SpecialPluginsUtils.cs:40)
    DG.Tweening.Tweener:DOStartupSpecials(TweenerCore`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tweener.cs:266)
    DG.Tweening.Tweener:DoStartup(TweenerCore`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tweener.cs:128)
    DG.Tweening.Core.TweenerCore`3:Startup() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenerCore.cs:230)
    DG.Tweening.Core.TweenManager:Update(UpdateType, Single, Single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:446)
    DG.Tweening.Core.DOTweenComponent:Update() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:75)
     
  28. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Randomly? As in: You are unable to reproduce the message deliberately?
    I'm assuming that it happens in "Play Mode" at irregular intervals. Is that a correct assumption ?

    Are you rotating something ?

    How to Fix Look Rotation Viewing Vector is Zero Unity Error
     
  29. Levr01

    Levr01

    Joined:
    Jun 6, 2017
    Posts:
    26
    Yep it happens in "Play Mode" at irregular intervals. But im use DORotate and DOLookAt and not use Quaternion:LookRotation. How to Fix Look Rotation Viewing Vector is Zero Unity Error cant help because error in "DG.Tweening.Plugins.Core.SpecialPluginsUtils:SetLookAt(TweenerCore`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Plugins/Core/SpecialPluginsUtils.cs:40)" i cant edit that
     
  30. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    DORotate and DOLookAt are methods of convivence to hide untold complexities ...
    DoTween is using Quaternion:LookRotation for you behind the scenes.

    What you have is akin to a "divide-by-zero" error.
    My professional opinion -without having seen any of your code - is that whatever values you're feeding your Tweens is what causing the issue; Not DoTween.
     
  31. ai190287

    ai190287

    Joined:
    Mar 30, 2021
    Posts:
    1
    Sorry for my poor English, I want to ask some question here, I just make a text animation using Dotween pro and all setting has been ready. When I press play, the text animation goes well. But if I press the back button and open the interface again, the text "Selection" cannot animate again, How to solve this problem?
     
  32. PeculiarCarrot

    PeculiarCarrot

    Joined:
    Aug 1, 2017
    Posts:
    2
    I'm having an interesting issue that I've never seen before. I have a tween that doesn't do anything unless I add it to a sequence. This happens even if I DOTween.Kill() the transform or transform.position beforehand. Is this a bug, or am I missing something obvious?

    Code (CSharp):
    1. //This works as expected
    2. var seq = DOTween.Sequence();
    3. seq.Append(transform.DOMoveY(newY, .5f));
    4.  
    5. //This seems to do nothing at all
    6. transform.DOMoveY(newY, .5f);
     
  33. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    The obvious thing would be that you have AutoPlay set to Sequences in the settings, as opposed to Tweeners or All
    You can see the preferences dialog here ... it's from another question, so the wrong bit is circled, but it's there under DEFAULTS



    I'm thinking just adding .Play(); to the end of your tweeners will sort you right out - ifin' you didn't want to change the defaults back to default for some reason.

    Code (CSharp):
    1. transform.DOMoveY(newY, .5f).Play();
    Fun fact... I have my Tweeners set to AutoPlay, and I tell my sequences to Play(); only when I want them to do so.
     
  34. PeculiarCarrot

    PeculiarCarrot

    Joined:
    Aug 1, 2017
    Posts:
    2
    Thanks for the help! I did check, and AutoPlay is actually still set to default. I tried adding .Play() to the tweener just in case, but it didn't change anything. All my other tweens in the project are fine as well.

    EDIT: I'm a complete moron, I was killing the tween right after. After hours of looking for bugs, I always find the cause right after asking for help lol. Sorry and thanks ^^"
     
    FuguFirecracker likes this.
  35. nicron2001

    nicron2001

    Joined:
    Mar 17, 2014
    Posts:
    4
    Hi,

    I just bought DOTween Pro to move a camera around the scene by tweening position and rotation. I also want to give the user the option to go more for a handheld style camera and use DOShakeRotation and DOShakePosition to create that effect whenever the respective option is selected. But when this is activated, the regular tween stops working and I am not smart enough to find a proper solution. So any help is greatly appreciated!

    Ben

    Code (CSharp):
    1. if (IsHandheld)
    2.     {
    3.     MainCamera.transform.DOShakePosition(TweenDuration, HandheldShakePosition, 1, 30f, true);
    4.    MainCamera.transform.DOShakeRotation(TweenDuration, HandheldShakeRotation, 1, 30f, true);
    5. }
    6.     DOTween.To(() => MainCamera.transform.position, x => MainCamera.transform.position = x, CameraProp2.transform.position, TweenDuration);
    7.     MainCamera.transform.DORotate(CameraProp2.transform.eulerAngles, TweenDuration);
    8.     MainCamera.GetComponent<Camera>().DOFieldOfView(CameraProp2.GetComponent<CameraValues>().fieldOfView, TweenDuration);
     
  36. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Blendable tweens.

    From the Docs:
    Tweens [tween] BY the given value (as if it was set to relative), in a way that allows other tweens to work together on the same target, instead than fight each other as multiple [tweens] would do.

    Code (CSharp):
    1. DOBlendableMoveBy(Vector3 by, float duration, bool snapping)
    2. DOBlendableLocalMoveBy(Vector3 by, float duration, bool snapping)
    3. DOBlendableRotateBy(Vector3 by, float duration, RotateMode mode)
    4. DOBlendableLocalRotateBy(Vector3 by, float duration, RotateMode mode)
    5. DOBlendableScaleBy(Vector3 by, float duration)
     
  37. nicron2001

    nicron2001

    Joined:
    Mar 17, 2014
    Posts:
    4
    Thank you for the direction and a blendable shake function might actually solve my problem, but since there is none, I will have to find another solution for my handheld camera since I am not able to make this work with my other tweens.
     
  38. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Can one not use a blendable move with the standard shake?
    (sounds like a fast food order )

    Do report back and let us know if blendable tweens are effective combined with the standard tweens.
    I don't recall if I've ever had occasion to try as such.

    You should know that there is nothing magical about the "shake" tweens... They just save you from a bunch of boilerplate... You can write your own shaking tweens using the blendable transorm tweens. It's really not that hard to move one thing to another and back again in small random increments ... you just can't do it in one line of code ;)
     
  39. nicron2001

    nicron2001

    Joined:
    Mar 17, 2014
    Posts:
    4
    Thanks a lot for the suggestions. The fast food menu looked better than the actual result and blendable tweens don't work with standard tweens in my example so I will have to learn a little more about DOTween and create my own shakes based on blendables. Thanks again for your support!
     
    FuguFirecracker likes this.
  40. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Perhaps you can play around with this until you get something acceptable
    Code (CSharp):
    1. using DG.Tweening;
    2. using UnityEngine;
    3.  
    4. public class FromHereToThereAndBackAgain : MonoBehaviour
    5. {
    6.     public float Amplitude =0.2f; // set in inspector
    7.     public float Duration = 0.2f;
    8.     void Start()
    9.     {
    10.         transform.DOBlendableMoveBy(new Vector3(10, 0, 0), 2)
    11.             .SetLoops(-1, LoopType.Yoyo)
    12.             .SetEase(Ease.InOutQuart)
    13.             .SetDelay(1)
    14.             .OnUpdate(() =>
    15.             {
    16.                 if (Input.GetKeyDown(KeyCode.Space))
    17.                 {
    18.                     GiveEmTheShakes();
    19.                 }
    20.             });
    21.     }
    22.  
    23.     private void GiveEmTheShakes()
    24.     {
    25.         var randomTremor =
    26.         transform.DOBlendableMoveBy(GetRandomTremor(), Duration)
    27.             .OnUpdate(() =>  GetRandomTremor())
    28.             .SetLoops(4, LoopType.Yoyo)
    29.             .SetEase(Ease.InFlash);
    30.     }
    31.  
    32.     private Vector3 GetRandomTremor()
    33.     {
    34.         return new Vector3(Random.Range(0, Amplitude), Random.Range(0, Amplitude), Random.Range(0,Amplitude));
    35.     }
    36. }
     
  41. nicron2001

    nicron2001

    Joined:
    Mar 17, 2014
    Posts:
    4
    Thank you so much. This has helped a lot and I am have learned a lot about Sequences as well. Combining all of this actually got me very close to what I wanted to achieve. Couple more lines of code than before, but a lot more flexible. Thanks again!
     
    FuguFirecracker likes this.
  42. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    You're welcome
    little mistake in my copy/paste there ... the GiveEmTheShakes method should be:
    Code (CSharp):
    1.  
    2. private void GiveEmTheShakes()
    3.     {
    4.         var randomTremor = GetRandomTremor();
    5.         transform.DOBlendableMoveBy(randomTremor, Duration)
    6.             .OnUpdate(() => randomTremor = GetRandomTremor())
    7.             .SetLoops(4, LoopType.Yoyo)
    8.             .SetEase(Ease.InFlash);
    9.     }
    10.  
    Now the OnUpdate will actually do something ;)
     
  43. ScottJak

    ScottJak

    Joined:
    Jul 23, 2020
    Posts:
    7
    Edit: Nevermind. This appears to be an issue with windows cloud builds when addressables are being compiled.

    Hello, big fan of DOTween, it's been the first thing I add to projects for years.

    I'm currently running into an error with Unity Cloud Build though. We're using:
    Unity 2020.3.6f1
    DOTween 1.2.420 (Release Build)
    DOTweenPro1.0.244
    DOTween ASMDEF (and other asmdef files in our project)
    Plastic SCM w/ no dlls excluded
    IL2CPP, .NET 4.x, Release (Stripping Level: Low)

    The project builds fine locally, but for some reason the cloud build is acting like the DOTween dlls don't have UnityEngine references (speculation on my part)? I've also used DOTween with cloud build in the past (like a year ago) without issue, so this caught me by surprise.


    [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/DOTween.Modules.dll
    33: [Unity] Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs(43,36): error CS0012: The type 'Quaternion' is defined in an assembly that is not referenced. You must add a reference to assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    34: [Unity] Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs(43,13): error CS0123: No overload for 'SetOrientationOnPath' matches delegate 'Action<PathOptions, Tween, Quaternion, Transform>'

    ...


    I've run out of ideas to try and am hoping you might have some suggestions :D

    Thanks!
     
    Last edited: May 14, 2021
    HakJak likes this.
  44. Atrolity

    Atrolity

    Joined:
    Oct 30, 2020
    Posts:
    1
    Kinda new to Unity and Programming overall so I feel like i've been out of my league on DOTween.

    Im using this on a projectile with 8 different paths on it, and every time that I use DOTween.Play, it plays every single prefab on the screen that has the same ID. How can I seperate how DOTween plays a certain ID on a certain gameobject without restarting all the other Prefab copys?

    Code (CSharp):
    1.         if (angle == 0) { DOTween.Play("Up"); }
    2.         else if (angle == 45) { DOTween.Play("UpRight"); }
    3.         else if (angle == 90) { DOTween.Play("Right"); }
    4.         else if (angle == 135) { DOTween.Play("DownRight"); }
    5.         else if (angle == 180) { DOTween.Play("Down"); }
    6.         else if (angle == -45) { DOTween.Play("UpLeft"); }
    7.         else if (angle == -90) { DOTween.Play("Left"); }
    8.         else if (angle == -135) { DOTween.Play("DownLeft"); }
    I felt like I learned a lot of cool things, but I feel like I'm missing some basics.
     
  45. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    Sorry to say, IDs are not the best choice for this. DoTween is going to play all tweens on all gameObjects with the ID you decide; That is the function of IDs. If you don't want that to happen, don't [re]use IDs.

    You need to decide on a GAMEOBJECT to control, not an ID.

    Looking at what you have here... I would:
    Enum for for 8 directions.
    Dictionary of vectors with the enum as key
    Control class that facilities the movement of all gameObjects.
    Control class has a ProjectileFire method that takes the enum and a gameObject

    Gettin you started :

    Code (CSharp):
    1.     public enum Direction{ Up, Down, Left, Right}
    2.  
    3.     // or use paths
    4.     public readonly Dictionary<Direction, Vector3> DirectionalLookup = new Dictionary<Direction, Vector3>()
    5.     {
    6.         {Direction.Up, Vector3.up},
    7.         {Direction.Down, Vector3.down},
    8.         {Direction.Left, Vector3.left},
    9.         {Direction.Right, Vector3.right}
    10.     };
    11.  
    12.     public Tweener FireProjectile(Direction dir, GameObject go, float duration)
    13.     {
    14.         return go.transform.DOMove(DirectionalLookup[dir], duration);
    15.     }
     
  46. doogiegonegood

    doogiegonegood

    Joined:
    Oct 1, 2013
    Posts:
    2
    Hi, I can't seem to find Async methods when using my Tweeners or Sequences.

    example:
    await myTween.AsyncWaitForCompletion();

    Have Tasks and Async been temporarily removed?

    The namespace I'm importing is DG.Tweening.
    All other DoTween things work fine.

    upload_2021-5-16_10-45-44.png
     
  47. nindim

    nindim

    Joined:
    Jan 22, 2013
    Posts:
    100
    Hi @Demigiant

    We are evaluating DOTween for all our UI animation and had planned to write an inspector tool for easily sequencing Tweens, something like this:


    It looks like perhaps the DOTween Timeline would do this for us out of the box though and I'm wondering if it ever got released? I don't see any reference to it in the DOTween Pro Asset Store overview or anything online after about August 2020.

    Thanks!
     
  48. gaterooze

    gaterooze

    Joined:
    Jul 17, 2019
    Posts:
    12
    Is anyone else seeing DOScale no longer working on TextMeshProUGUI components? I've always used it on previous projects in the exact same way, but now on Unity 2020.3.5f1 with DOTween Pro 1.0.244 it won't even show up in the Intellisense hints. DOScale still works on Transforms, but the documentation doesn't indicate that it's been deprecated on TMPro texts...

    upload_2021-5-17_11-2-16.png

    Edit: BTW scaling the text's transform directly still works as a workaround, it's just odd that it's not working correctly like it used to (for me, anyway).

    Edit2: Interesting follow-up. I was in the middle of testing and DOFill had been working fine on images, when suddenly DOTween threw an error and then DOFill (or any other tween, it appeared) was no longer recognized as a valid method - it instantly switched from being a-okay to refusing to compile. So I did a complete re-install of DOTween and it fixed both that and the original problem.
     
    Last edited: May 21, 2021
  49. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    358
    It isn't.
    Check your setup. See if you remembered to import the Text Mesh Pro Module.
    If it's not that, it could be ASMDEF files not properly referenced, if you are using those.

    Nossir, something with your setup...


    Unity 2020.1.6 , DOTween 1.0.244
     
    doogiegonegood likes this.
  50. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    162
    hey, did anyone do a stress test: DoTween vs LeanTween? Who is win? What engine will I get to use)
     
unityunity