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:
    798
    Try changing the RotateMode which is the third parameter that you can pass to DoRotate or DoLocalRotate.

     
  2. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    You have whole documentation here: http://dotween.demigiant.com/documentation.php
    You'll find that DORotate has RotateMode with Fast as default. You need other mode...
     
  3. peterk1968

    peterk1968

    Joined:
    May 11, 2015
    Posts:
    63
    I know this is an old issue but I didn't see an answer posted and I just hit and solved this, so....

    If anyone is looking for a solution to the "tk2dBaseSprite not found" issue, you need to go to the DOTween control panel and uninstall 2D Toolkit in the external assets section.

    If you select modules in the setup that you are aren't actually using in your project, you'll get DOTween related compile errors.

     
  4. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    44
    Any chance of LWRP components like Light2D, being supported soon?
    Cheers
     
  5. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @friklic You should be able to tween anything you have access to in Unity. If you want those nice shortcut extension methods it's pretty easy to make them. Something like this:

    Code (CSharp):
    1. public static Tweener DOColor(this Light2D target, Color endValue, float duration)
    2. {
    3.     return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
    4. }
     
    PepperPaige, doarp and frikic like this.
  6. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    NOT WORK PRO VERSION ON UNITY 2019.2.
    PC BUILD.

    upload_2019-10-20_19-32-9.png upload_2019-10-20_19-32-26.png
     
  7. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    Asset abandoned?
     
  8. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    It's not, asset is regularly updated with addons and bug fixes. I just think author doesn't have time to check the forum...
     
    Last edited: Oct 23, 2019
    Demigiant likes this.
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Ahoy @StrongCube (and thanks for @iMobCoding) :) That's because you're using a more recent version of DOTween than of DOTween Pro. If you update DOTween Pro from the Asset Store that error will disappear.
     
  10. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    44
    @flashframe thanks that's really nice to know ;)
     
    flashframe likes this.
  11. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    Hello, we are working with DOTween Pro v.1.0.155.
    We have been using DOTween mostly for canvas animations and such. Currently we are using lots of them, but never all together, maximum 2 at the same time.
    When we were profiling our game because we found some frame drops we found this:

    The DotweenComponent.Update() is taking 99.5% of the frame (see image attached below)

    Any suggestion of why is this happening or how to aboard it?
    Didnt have any problem with the asset until now.
    Thanks!
     

    Attached Files:

  12. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Looks like the issue is not with DoTween but with whatever you are tweening. Can you share your code?
     
  13. AlejUb

    AlejUb

    Joined:
    Mar 11, 2019
    Posts:
    25
    There's something that's been a bit difficult for me nail.
    Is there are way to have a "DOTweenAnimation as the parent object and make it be applied to all children of a game object?
    I have tried instantiating a DOTweenAnimation.Instantiate, passing a DOTween animation "template" and changing the target... but this is actually crashing on my side.
    It would be also nice to have a "DOTweenSettings" struct that could be used to for any new created DOTween or any script that would benefit from DOTween internal settings and usage.
    Any help would be apprieciated.
     
  14. ColdPixel

    ColdPixel

    Joined:
    May 22, 2019
    Posts:
    7
    I am experiencing weird behavior with a tween rotation. I have a very simple gameObject with the following script to rotate it between opposite sides (180 degrees about X axis). I should mention that I am on Unity 2019.2.9f1 and the latest DOTween Pro (just installed today from Unity Store)

    Code (CSharp):
    1. public class MapCardMover : SerializedMonoBehaviour
    2.     {
    3.         [Button]
    4.         public void FlipToBack()
    5.         {
    6.             transform.DORotate(
    7.                 new Vector3(180, 0, 0), 1, RotateMode.FastBeyond360);
    8.         }
    9.         [Button]
    10.         public void FlipToFront()
    11.         {
    12.             transform.DORotate(
    13.                 new Vector3(0, 0, 0), 1, RotateMode.FastBeyond360);
    14.         }
    15.     }


    As shown in the video clip:

    1. Click FlipToFront - does nothing because X rotation already = 0. Good!
    2. Click FlipToBack - tween the rotation X-axis value only to 180. Good!
    3. Click FlipToBack again - wobbles about X, Y, and Z axes ?!? Why? I expected it to do nothing (like #1 above) because rotation X-axis value is already 180.
    4. Click FlipToFront - wobbles about X, Y, and Z axes ?!? Why? I expected it to rotate only about the X-axis (like #2 above) because Y and Z axes are already 0.

    I have done more experiments:
    • The above-described weird behavior does not occur when it is rotation about Y axis or Z axis instead of X axis.
    • The above-described weird behavior only seems to apply when changing X rotation from/to a value greater than 90. Can rotate X-axis angle between 0 and 90 without problems. But 0 to 91 causes the behavior above. Also 10 to 91, and 95 to 96. Any X rotation angle above 90 causes the above-problem.
    • The above-described weird behavior is reproducible in the inspector by adding two "DOTween Animation" components to a gameObject - one that rotates to X=180 and one that rotates to X=0.
    • I also created a new Unity Project, imported only DOTween, and confirm that this behavior is still present (so it is not caused by an interaction with other plugins/assets)
     
    Last edited: Oct 25, 2019
  15. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Have you tried:

    1. Using RotateMode.Fast instead of FastBeyond360
    2. Using DoLocalRotate instead of DoRotate
    3. Using RotateMode.LocalAxisAdd. Would need to change the code to something like this:

    Code (CSharp):
    1. public class MapCardMover : SerializedMonoBehaviour
    2.     {
    3.         private bool isFlipped;
    4.  
    5.         [Button]
    6.         public void FlipToBack()
    7.         {
    8.             if(isFlipped) return;
    9.             isFlipped = true;
    10.  
    11.             transform.DOLocalRotate(
    12.                 new Vector3(180f, 0, 0), 1f, RotateMode.LocalAxisAdd);
    13.         }
    14.         [Button]
    15.         public void FlipToFront()
    16.         {
    17.             if(!isFlipped) return;
    18.             ifFlipped = false;
    19.  
    20.             transform.DOLocalRotate(
    21.                 new Vector3(-180f, 0, 0), 1f, RotateMode.LocalAxisAdd);
    22.         }
    23.     }
     
  16. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Do you have to use the DOTweenAnimation component? Could you create your own component that does what you need?
     
  17. Cicaeda

    Cicaeda

    Joined:
    Sep 29, 2017
    Posts:
    34
    I'm having this same issue in 2019.2
     
  18. ColdPixel

    ColdPixel

    Joined:
    May 22, 2019
    Posts:
    7
    Thanks for your suggestions. I tried them, as follows:

    1. Using RotateMode.Fast produces the same weird behavior.
    2. Using DoLocalRotate produces the same weird behavior.
    3. Using LocalAxisAdd does not produce the weird behavior. However, if the rotation is interrupted (e.g. stopped or reversed midway), you end up drifted.
    4. My current workaround is putting the gameObject as a child under a parent gameObject that has z-rotation of 90 degrees so that I can rotate the child about the Y-axis instead - because the problem only happens with X-axis.
    I am convinced this is a bug.
     
    Last edited: Oct 26, 2019
  19. ColdPixel

    ColdPixel

    Joined:
    May 22, 2019
    Posts:
    7
    As a follow-up to my previous posts, I have made an easily reproducible test, as follows:
    1. Created a New Unity Project (in Unity 2019.2.10f1)
    2. Imported the latest version of DOTween Pro (v.1.0.165)
    3. Right Click > 3D Object > Cube
    4. Cube > Transform > Right Click > Reset
    5. Drag CubeRotator onto Cube (see code below)
    6. Play
    See video below
    • The cube spins about X, Y, and Z axes as it rotates from RotationX = 180 to Rotation X = 0. Am I the only one with this problem? What I am doing wrong?
    • Importantly, when I change the rotation to the Y axis or Z axis, the cube rotates only about the axis it is supposed to. Only X axis rotation is bugged.

    Code (CSharp):
    1. using System.Collections;
    2. using DG.Tweening;
    3. using UnityEngine;
    4.  
    5. public class CubeRotator : MonoBehaviour
    6. {
    7.     private void Start()
    8.     {
    9.         StartCoroutine(RotateCube());
    10.     }
    11.  
    12.     public IEnumerator RotateCube()
    13.     {
    14.         yield return new WaitForSeconds(1);
    15.        
    16.         transform.DORotate(
    17.             new Vector3(180, 0, 0), 1, RotateMode.FastBeyond360);
    18.  
    19.         yield return new WaitForSeconds(1);
    20.    
    21.         transform.DORotate(
    22.             new Vector3(0, 0, 0), 1, RotateMode.FastBeyond360);
    23.     }
    24. }
     
    Last edited: Oct 27, 2019
  20. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Hi

    Assuming i have 7+ objects to change position at the same time, currently i do this

    for loop{
    items.DOMove(newPostion, 1);
    }

    but i recently came to know about sequences/parallels

    so my question is, is using a sequence more performant than individually looping?

    Thanks
     
  21. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hi There. I want to throw a +1 on adding a RotateAround method. My objects have multiple possible rotation points I am using this.gameObject.transform.RotateAround currently and using Vector3s from child objects that sit at various locations to add rotation from. I was hoping to animate these, now that it is working as expected, and throw in a little easing to make it look springy. I have read through all 64 pages and see that it's been in the works since 2015. Obviously a tough nut to crack.

    Edit! I am also hoping to use this in a sequence! I didn't realize it until I've started messing around with it.
     
    Last edited: Oct 31, 2019
  22. ColdPixel

    ColdPixel

    Joined:
    May 22, 2019
    Posts:
    7
    @Izitmee / DEMIGIANT Any help?

     
  23. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    I need a little help with this.GetTweens() returns Tween but ChangeEndValue can be called by a Tweener, not a Tween. The answer produces 'Tween' does not contain a definition for 'ChangeEndValue'
     
  24. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Is there any way we could get the EaseManager exposed for simple use like the current Unity Lerp? Just provide it a simple number between 0 and 1 to get the value between the start and end numbers supplied.
     
  25. QoQoo1321

    QoQoo1321

    Joined:
    Apr 5, 2014
    Posts:
    6
    Hi!

    The 2d object is moved by DoTween Path.
    I want to start operation every time I press a button on the UI.
    You can run the first time, but not the second time.

    Complated event is set from the inspector,
    There are events properly.

    I also want to make a reciprocating movement.
    In the inspector, loop specifies 2, yoyo.

    Thank you!

    Code (CSharp):
    1. Tween doani;
    2. public void Anipaly()
    3. {
    4.   doani.Kill();
    5.   doani = this.transform.parent.GetComponent<DOTweenPath>().GetTween();
    6.   doani.Restart();
    7.   Debug.Log("restart");
    8. }
    9.  
    10. public void AniComplated()
    11. {
    12.   Debug.Log("Ani Complated!");
    13. }
     
  26. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    142
    Understanding Sequences:

    I am working on a "dynamic" sequence that uses the values of the previous DOTween to determine the current object movement.

    As a test, I wrote a small sequence that had a 1 sec delay and a callback to a method to return a random number 1-100 to the debug.log. It did return random numbers. I wasn't sure if it would be the same value every time or not as sequences are described as unchanging.

    Code (CSharp):
    1.     void Start()
    2.     {
    3.         var tst = DOTween.Sequence();
    4.         tst.AppendInterval(1f)
    5.        .AppendCallback(() => randtest())
    6.        .OnComplete(() => tst.Restart());
    7.     }
    8.  
    9.     private void randtest()
    10.     {
    11.         var rnd = new System.Random();
    12.         var test = rnd.Next(0, 100);
    13.         Debug.Log(test.ToString());
    14.     }
    I could break on the first line of randtest() and it would be hit on every loop.

    Alternatively, this script is closer to how I approached adding things to the sequence: (just plucking the DOTween from the child methods that did the math)

    Code (CSharp):
    1.     void Start()
    2.     {
    3.         var tst = DOTween.Sequence();
    4.         tst.AppendInterval(1f);
    5.         randtest(tst);
    6.         tst.OnComplete(() => tst.Restart());
    7.     }
    8.  
    9.     private void randtest(Sequence tst)
    10.     {
    11.         var rnd = new System.Random();
    12.         var test = rnd.Next(0, 100);
    13.         var compare = 0;
    14.         tst.AppendCallback(() => compare = test);
    15.         Debug.Log(test.ToString() + " " + compare.ToString());
    16.     }
    This only "runs" once (outputs to the log). I can see that it does loop infinitely, but the log does not get written to, and the value of test and compare are always the same in every loop. Only the line with .AppendCallback() will hit a breakpoint.

    Because of my approach, I believe I have to create a new sequence every time if I want to "loop" the results, as they would be different each loop. However, I would like to make the loop breakable by keypress. I think this could cause a race condition where the "stop" keypress is followed by the loop infinitely. Could I make a parent sequence that creates a new sequence as a child every loop? Then I could stop it by using OnComplete(null) on the parent, maybe?

    Any ideas?
     
  27. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Heads up!
    Dotween does not work for Fast Enter-To-Play mode for 2019.3

    Yeah, I know it's still beta but the release is any day now.
    I hope Dotween does not prevent us from using the Fast Enter-To-Play mode.
    If you use it the Fast mode, there is no way you want to go back. It supports almost an instant play.

    Dotween will need to initialize the static data instead of relying on AppDomain to reset it for you.

    Thanks.
     
    doarp likes this.
  28. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    142
    Building on a previous post, I think I may have found a bug. I was trying to make a sample project to see why mine was freaking out. And just when I thought I figured it out. It worked normally. In the example script below, I have a nested sequence. If you fire the parent sequence first, it goes crazy. BUT, if you first fire the child sequence then the parent, the parent will adhere to the child's timeline. I'm hoping that Daniele shows up soon (he is abnormally absent) and can offer up some ideas about this. In the meantime if any of you power-users want to take a crack, have at it! I have described the simple test scene in the code comments.

    Code (CSharp):
    1. using DG.Tweening;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class seqTest3 : MonoBehaviour
    6. {
    7.     private Sequence parent;
    8.     private float duration;
    9.  
    10.     public bool FireChild;
    11.     public bool FireParent;
    12.  
    13.     // Empty Scene with 3 cubes next to each other named Cube1, Cube2, Cube3.
    14.     // Empty game object with script on it. 2 check boxes in inspector to fire the methods.
    15.     // Child sequence is a one off. Parent sequence has a restart on complete.
    16.     // If you fire parent first, and the boxes do not adhere to the time they just fly away.
    17.     // If you fire child first, then fire parent, and the parent sequence uses times.
    18.  
    19.     void Update()
    20.     {
    21.         if (FireChild)
    22.         {
    23.             FireChild = false;
    24.             createChild();
    25.         }
    26.  
    27.         if (FireParent)
    28.         {
    29.             FireParent = false;
    30.             createParent();
    31.         }
    32.     }
    33.  
    34.     public void createParent()
    35.     {
    36.         parent = DOTween.Sequence()
    37.             .SetAutoKill(false)
    38.             .AppendCallback(() => createChild())
    39.             .AppendInterval(duration)
    40.             .OnComplete(() => parent.Restart());
    41.     }
    42.  
    43.     public void createChild()
    44.     {
    45.         var listy = new List<GameObject>
    46.         {
    47.             GameObject.Find("Cube1"),
    48.             GameObject.Find("Cube2"),
    49.             GameObject.Find("Cube3")
    50.         };
    51.  
    52.         var child = DOTween.Sequence();
    53.         setCallBack(listy, child);
    54.         duration = child.Duration();
    55.     }
    56.  
    57.     private void setCallBack(List<GameObject> listy, Sequence child)
    58.     {
    59.         foreach (var thing in listy)
    60.         {
    61.             var rand = (float)rando();
    62.             Debug.Log("Wait " + thing.name + " " + rand.ToString());
    63.             child.AppendCallback(() => planToMove(thing.transform)).AppendInterval(rand); // move each, append a wait interval
    64.         }
    65.     }
    66.  
    67.     public int rando()
    68.     {
    69.         var rnd = new System.Random();
    70.         return rnd.Next(1, 5);      
    71.     }
    72.  
    73.     public void planToMove(Transform thing)
    74.     {
    75.         var rand = rando();
    76.         thing.DOMove(new Vector3(thing.position.x, thing.position.y, thing.position.z + rand), .5f); //move the z a random amount beween 1-3.
    77.         Debug.Log("Move " + thing.name + " " + rand.ToString());
    78.     }
    79. }
     
    EaglemanGameDev likes this.
  29. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    Is there a way to get the points from the Path class of DoTween? I'm not talking about the waypoints, instead I need to get some the points that make up the curve. For example one could pass a distance to the path so that it returns a list of points that have a space between each other equal that distance.

    I would like to use these points to pass to one of my NavMeshAgents so that he can travel to a destination in a circular fashion instead travelling linearly to it.
     
  30. Gigacee

    Gigacee

    Joined:
    Mar 4, 2015
    Posts:
    53
    I use QHierarchy. An error icon is displayed on a GameObject with DOTween Animation attached. I'm not sure if this is due to a QHierarchy problem or a DOTween problem, but I would like to inform you just in case.

    私は QHierarchy を使っているのですが、DOTween Animation がアタッチされたゲームオブジェクトにエラーアイコンが表示されてしまいます。これが QHierarchy の問題に起因するものなのか、それとも DOTween の問題なのか判りませんが、念の為ご報告させていただきます。

    upload_2019-11-15_13-2-40.png
     
  31. cemnahit

    cemnahit

    Joined:
    Dec 26, 2012
    Posts:
    39
    Hi, I am working on a timing based mobile game that uses DOTween Pro. I have a problem where the animations are affected when applying "Application Target Framerate" to 60fps. The problem is, I don't get what I experience in editor when building the game for a mobile device. In time the animations become out of sync which actually ruins the game, but this does not apply to DoTween Path. If I use 30fps it works flawlessly but running the game at 60fps makes a huge difference in these type of games. Do anyone have any idea how to fix this issue? Thanks.

    SOLVED: Changed update type to manual in DoTween general options and used

    Code (CSharp):
    1. private void FixedUpdate()
    2. {
    3.     DOTween.ManualUpdate(Time.deltaTime, Time.unscaledDeltaTime);
    4. }
    code especially inside FixedUpdate solved sync problems. However this causes animations to jitter if you slow up time with Time.timeScale.
     
    Last edited: Nov 15, 2019
  32. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, will Dotween be compatible with Fast-Enter-To-Play when 2019.3 release?
    It really makes a big difference and it's probably the best feature in years.

    Right now, Dotween is keeping me from using it and I'm a bit worried.
    Please let us know if you are looking at it.
    Thanks.
     
  33. Gigacee

    Gigacee

    Joined:
    Mar 4, 2015
    Posts:
    53
    Hi, I created a class that allows you to play, rewind, await and skip multiple tweens together.

    複数の Tween をまとめて再生、巻き戻し、待機、スキップができるクラスを作りました。

    https://github.com/Gigacee/DOTweenList

    for example:
    Code (CSharp):
    1.  
    2. var dotweenList = new DOTweenList(
    3.     rectA.DOAnchorPosX(600f, 0.6f),
    4.     rectB.DOAnchorPosX(600f, 0.8f),
    5.     rectC.DOAnchorPosX(600f, 1f)
    6. );
    7.  
    8. await dotweenList.PlayForward().Skippable(() => Input.anyKeyDown);
    9.  
    Thanks!
     
    doarp likes this.
  34. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    @Izitmee Yes, I am also interested in this? Thanks
     
  35. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    @Izitmee Also, why asset store version is still v1.2.280 and there is already v1.2.305 on your site? Thanks
     
  36. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    v.1.2.305 will work with Fast Enter To Play mode and I was told that he will push new updates to the Asset store soon.
    - a very happy camper.
     
  37. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Hello,

    It seems that creating a teen to fade a SpriteRenderer generates garbage and therefore the GC to collect. I didn't noticed before, but because I'm doing this on thousands of objects it appears clearly in the profiler.

    Code (CSharp):
    1. _spriteRenderer.DOFade(1f, 0f);
    Is that normal ? How can I prevent that ?

    Thanks
     
    doarp likes this.
  38. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    When using DOTween (current version from Asset Store, Unity 2019.2.x) I get a lot of these messages:

    Code (csharp):
    1. DOTWEEN ► Tween startup failed (NULL target/property - ): the tween will now be killed ► The object of type 'JumpUpDownBehavior' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Debug:LogWarning(Object)
    4. DG.Tweening.Core.Debugger:LogWarning(Object) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:33)
    5. DG.Tweening.Tweener:DoStartup(TweenerCore`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tweener.cs:138)
    6. DG.Tweening.Core.TweenerCore`3:Startup() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenerCore.cs:230)
    7. DG.Tweening.Core.TweenManager:Update(UpdateType, Single, Single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:444)
    8. DG.Tweening.Core.DOTweenComponent:Update() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:73)
    9.  
    But I also get this message where it says I should contact the developer with my stack trace to improve DOTweens performance. You can reproduce that by un-commenting under OnDespawn:

    Code (csharp):
    1.  using UnityEngine;
    2.  
    3. using DG.Tweening;
    4.  
    5. public class JumpUpDownBehavior : MonoBehaviour
    6. {
    7.     public float dur;
    8.  
    9.     Vector3 initPos;
    10.     Tweener twMove, twTurn;
    11.  
    12.     void Start()
    13.     {
    14.         initPos = transform.position;
    15.         Init();
    16.     }
    17.  
    18.     public void Init()
    19.     {
    20.         //    Sequence seq = new DOTween.Sequence();
    21.  
    22.         twMove = DOTween.To(() => transform.localPosition, x => transform.localPosition = x, new Vector3(0f, -1 * initPos.y, 0f), dur)
    23.             .SetEase(Ease.InOutExpo)
    24.             .SetLoops(-1, LoopType.Yoyo);
    25.  
    26.         twTurn = DOTween.To(() => transform.localRotation, x => transform.localRotation = x, new Vector3(0f, 180f, 0f), dur)
    27.             .SetEase(Ease.InOutExpo)
    28.             .SetLoops(-1, LoopType.Yoyo);
    29.     }
    30.  
    31.     void OnDespawn()
    32.     {
    33.         //twMove.Pause();
    34.         //twTurn.Pause();
    35.         //twMove.Rewind();
    36.         //twTurn.Rewind();
    37.         //   twMove.Kill(transform);
    38.         //  twTurn.Kill(transform);
    39.         //twMove = null;
    40.         //twTurn = null;
    41.         DOTween.Kill(transform);
    42.     }
    43. }
    44.  
    Anybody knows how to improve my code? My goal is to have power ups that move up and down. They get collected, get destroyed and a new power up is created. Nothing fancy really but DOTween doesn't like it.
     
    pistoleta likes this.
  39. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    89
    hello, I made a VR canvas of world space,and attached a "box collider(3D)"component on UGUI button. but when timescale is zero, and played a Doscale animation of zero to one, then animation was right, but box collider can't used for Physics.raycast,because its size was zero. what can I do? thank you!
     
  40. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    @Izitmee
    In the DoTweenAnimation script (DOTweenAnimation_Advanced sample scene), the Color transition (toRed) is not working for LWRP.
    I guess that is because in LWRP the material property is "_BaseColor".
    How do I make it work?
     
  41. Cris_2013

    Cris_2013

    Joined:
    Nov 25, 2017
    Posts:
    39
    Hi there, does anyone know how to detect a Tweener has finished going backwards?
    I would like to get a lambda function in the same fashion as the OnKill of playing forward:
    i.e. Tweener = object.DoMove(destination, 1.0f).OnKill(()=> Tweener = null);

    Many thanks!
     
  42. BackwardsCompatible

    BackwardsCompatible

    Joined:
    Apr 28, 2019
    Posts:
    2
    Hello - i want use for VRChat this program but VRChat not allow scripting / can this output to animator files or be used without any script in game even if limited ? - many thanks
     
  43. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    Hello guys.
    Can you explain me, how to create some looping effect with attenuation (for example ball bouncing effect with jump count param) ?
    Many thanks.
     
  44. m4a44

    m4a44

    Joined:
    Mar 13, 2013
    Posts:
    45
    Hey, is there a proper way to use DO Tween Path within a nested prefab? I am not seeing anything to set it as relative (or use transforms for the path) and the path is messing up.

    Basically, what I'm seeing is if the object hasn't been looked at in the editor before playing (which refreshes it's points?), it just mixes the object prefab location with the path world locations (which has it flying off screen).

    I can't just use the DO Tween Animation (move), as it doesn't have arch/spline support from what I've seen. And I am hoping I don't have to make my own script for something so simple (considering we have the Pro version).
     
  45. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    470
    Hi,
    I'm having a weird issue here and it's recent, it didn't exist until I recently moved to Unity 2019.2.15f1.
    There's a script that moves a panel up using anchor Y (component.DOAnchorPosY).
    For some reason, when running the game, that particular tween will not play until I click anywhere outside of the Game window with the left, right or middle mouse button.
    The tween is literally blocked until something in Unity's UI (of the editor) related to a click event happens outside of the Game tab.
    I just updated DoTween free (without destroying the folder and modules), moving form 250, to see if something was causing the issue in the old version that got corrected in the latest version, but the bug is still there.
    It's very weird and I'm trying to understand what kind of interaction there could be between DoTween and the editor's UI.
    I wonder, has anything like that happened in the past?
     
  46. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Really liked the ability to preview a DOTweenAnimation in edit mode. Are you planning to add similar preview controls to DOTweenPath? That would be really great!
    Thanks!
     
  47. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Hi,

    I needed to update dotween in order to use an asset called DoozyUI.

    I was previously on version 1.1.7, so I followed the steps found here:
    guide.png

    However, After doing those steps, I can't access my package manager at all, and I get errors such as:
    error.png

    I don't get it, help please!!!
     
  48. roointan

    roointan

    Joined:
    Jan 8, 2018
    Posts:
    78
    I wanted to scale down a transform, using:

    .transform.DOBlendableScaleBy(new Vector3(.5f, .5f, 1), .2f)

    But it does not scale down. it actually scales up.
    Any solution?

    EDIT:
    This works :)

    object.transform.localScale = new Vector3(.5f, .5f, 1);
    object.transform.DOBlendableScaleBy(new Vector3(1f, 1f, 1), .2f).From();
     
    Last edited: Dec 30, 2019
  49. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    36
    I have a prefab setup with a DoTween as shown in the image


    and I am trying to change the parameters the DoTweenAnimation via script as follows:
    Code (CSharp):
    1.  
    2.  this.GetComponent<DOTweenAnimation>().duration = m_speed * 100f;
    3.         this.GetComponent<DOTweenAnimation>().isSpeedBased = true;
    4.         this.GetComponent<DOTweenAnimation>().endValueV3.x = GameManager.Instance.Player.gameObject.transform.localPosition.x + GameManager.Instance.Player.GetComponent<RectTransform>().rect.width;
    5. ;
    6.  
    which works and I can see the values get updated in the editor.
    But if I call
    Code (CSharp):
    1.   this.GetComponent<DOTweenAnimation>().DOPlay();
    or
    Code (CSharp):
    1. this.GetComponent<DOTweenAnimation>().DOPlayById("ToMove") ;
    the object does not move.
    But if I call
    Code (CSharp):
    1. this.GetComponent<DOTweenAnimation>().DOPlayAllById("ToMove") ;
    it works but I will have multiple objects and I dont want them all to begin moving at the same time or as soon as they are created.
    I have also tried using DoLocalMoveX on the object and that too doesnt work.
    If I keep autoplay enabled, the object moves . Is there any way to trigger the play from code after I have populated the values as the levels progress?
    The gameobject in question is an image inside a canvas.
     
  50. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hi
    Long time lover of DOTween just encountered a bug and attached a reproduction.

    Problem:
    Using both
    SetDelay()
    and
    SetUpdate(true)
    causes the delay to be wrong for anything other than 0 seconds delay.

    Extract the package into a fresh unity project (or just add it to one) and open the sample scene.
    Observed behaviour is that the item with 0 delay moves immediately but those with anything more (multiples of 0.15s) wait much longer (more like 3seconds).
    Expected behaviour would be they'd all move shortly after one another.
    In the code you'll see I've tried various things. If I remove use of
    SetUpdate(true)
    , it behaves as I'd expect.

    Thank in advace for any help :)

    P.s. [EDIT] I'm using 2018.3.13f1 in case it makes a difference.
     

    Attached Files:

    Last edited: Jan 4, 2020