Search Unity

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,242
    Hey @zhuchun! Glad you like the generic way: it's the core of DOTween after all :)

    Every tween has a specific timeScale property you can set only for it. But beware, it's not independent from the global DOTween timeScale. Final timeScale of a tween is:
    Unity.Time.timeScale * DOTween.timeScale * Tween.timeScale
    (Unity.Time.timeScale is ignored if you set the tween to be timeScale independent)

    BTW, I love the generic way, but there are also shortcuts for shader properties (which in the background use that exact generic way you wrote):
    Code (csharp):
    1. rend.material.DOFloat(1f, "_Blend", blendTime);
     
    zhuchun likes this.
  2. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    92
    Hi,
    When setting:
    DOTween.defaultTimeScaleIndependent = true;

    I am no longer able to do pause and step frame by frame, it simply go too fast.
    Is that by design?
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hi,

    What you mean with "pause and step frame by frame"? If you mean doing that via Unity, then indeed that won't work, because Unity pauses and goes step by step by modifying its internal timeScale, which will be ignored if you set the tween to timeScaleIndepentent.
     
  4. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    395
    Hey man,

    Have been using DOTween for awhile now and have superb results, thank you. However, I'm having a problem with DOLocalRotate. It looks like the rotations aren't taking the shortest path.

    I'm trying to programmatically animate between two different hand poses (including fingers). I store two different hand poses as a collection of transforms and rotations. I'm trying to uses DOLocalRotate to smoothly animate between the two poses but some of the fingers spin incorrectly.

    I have tried using RotateMode.FastBeyond360 but still no luck. I can provide a demo project if that helps?

    Cheers
     
    Last edited: Aug 21, 2015
  5. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Hi Daniele. So far I'm having a smooth ride with DOTween, great job! :)
    One thing I didn't get to work was the shortcut way of Image.DOFillAmount, although of course the generic way works.
    It doesn't even show up in the autocomplete, any idea why? Cheers!
     
  6. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    @MaDDoX

    I'm having the exact same problem! Image's DOFill() doesn't use my duration value! Mine's set to a radial fill, though I'm not sure how important that is...
     
  7. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hey @MaDDoX! Glad you're liking it for now :) To both you and @solar_blitz: I think you might have not run the setup? Which means the specific Unity 4.6 shortcuts weren't imported. I'm attaching a fillAmount example just in case.

    @silentslack Glad you like it! And a finger tween seems like a complex thing indeed. Can you send me the example you were talking about, so I'll check it out? I'm going to PM you with my mail now.
     

    Attached Files:

  8. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    @Izitmee I imported the attachment and its DOFillAmount tween worked perfectly. I do not understand what changed between the two scenes to make it work, however. I don't think my code is wrong.

    Does DOTween Setup affect the whole project or just an individual scene?
     
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    That is weird *_* The Setup affects the whole project: it imports additional scripts/shortcuts based on your Unity version.
     
  10. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    Here's the code I am using

    Code (csharp):
    1. public float rechargeDuration = 1f;
    2.  
    3. //...
    4.  
    5. powerRechargeImage.DOFillAmount(0f, rechargeDuration).OnComplete (powerRecharged).SetEase (Ease.Linear);
    Here's some other important statistics, possibly relevant:

    I'm running DOTween version 1.0.805 [release build] which contained the fix to the Sequence.Join() issue I reported earlier this month.

    My Unity build is version is 5.0.1f1 (we're not able to change it at this point in time).

    Here are my settings and defaults:

    Safe Mode: ON
    Log Behaviour: Errors Only
    Show Unity Editor Report: False
    TimeScale (Unity/DOTween): 1/1

    defaultRecyclable: False
    defaultUpdateType: Normal
    defaultTSIndependent: False
    defaultAutoKill: True
    defaultAutoPlay: All
    defaultEaseType: OutQuad
    defaultLoopType: Restart
     
    deniztkaymakci likes this.
  11. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Your code and settings seem definitely alright to me. Can you tell me more of what you mean with the tween not using your duration value? Is it faster? Slower? Always seems to use the same duration? Are you sure you're not changing Unity's timeScale somewhere and influencing the tween's speed?
     
  12. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    It is much slower and always the same rate, roughly 14 or 15 seconds (which was the original value I set those tweens' duration to). The only change to Time.timeScale is the Pause function which sets it to a value of 0f. Unpausing sets Time.timescale back to 1f.
     
  13. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    I don't know what to think of. Duration has never been an issue and has always worked. Maybe "rechargeDuration" is changed before you apply it? Could you run a log just before creating the tween to verify that? And if that doesn't solve the issue, maybe you could send me a repro so I can check it out?
     
  14. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    @Izitmee I found out it wasn't a DOTween issue, it was a "public variable whose Inspector value overrides the script value" issue. Thanks again for the help!
     
  15. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Glad you solved it :)
     
  16. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    Hi @Izitmee , first of all I wanna say thanks for making DOTween available, I've been learning for this couple days, and I cannot see myself not using DOTween in any project.

    I have a problem with callbacks though, here is my code:
    Code (CSharp):
    1.     public void FillGrid()
    2.     {
    3.         Sequence fillSequence = DOTween.Sequence();
    4.         fillSequence.SetAutoKill();
    5.  
    6.         for (int x = 0; x < gridWidth; x++)
    7.         {
    8.             for (int y= 0; y < gridHeight; y++)
    9.             {
    10.                 //check if gridObj occupant is null on x and y index
    11.                 if (gridObj[x,y] == null)
    12.                 {
    13.                     //generate random index with max from tilePrefabs length
    14.                     int randomTile = Random.Range (0, tilePrefabs.Length);
    15.                     gridPos[x,y] = new Vector3 (x + posOffset, y + posOffset, 0f);
    16.                     gridObj[x,y] = Instantiate (tilePrefabs[randomTile], new Vector2 (x + posOffset, y + posOffset), Quaternion.identity) as GameObject;
    17.                     gridObj[x,y].transform.position = new Vector3 (x + posOffset, 8.5f, 0f);
    18.                     //store tile object transform
    19.                     Transform objTransform = gridObj[x,y].transform;
    20.                     //Get distance from start to target position
    21.                     float dist = 8.5f - (y+posOffset);
    22.                     //insert tween
    23.                     fillSequence.Insert(0, objTransform.DOMoveY(y + posOffset, dist/yVelocity).SetEase(Ease.OutBounce));
    24.                 }
    25.             }
    26.         }
    27.         fillSequence.OnComplete(()=>
    28.         {
    29.             fillSequence.Kill(false);
    30.             playerInput.CheckAfterFall();
    31.             print("fill Completed");
    32.         });
    33.     }
    34.  
    35.  
    36.     public void CompressGrid()
    37.     {
    38.         Sequence fallSequence = DOTween.Sequence();
    39.  
    40.         for (int x = 0; x < gridWidth; x++)
    41.         {
    42.             int emptySpaces = 0;
    43.  
    44.             for (int y= 0; y < gridHeight; y++)
    45.             {
    46.                 //check if gridObj occupant is null on x and y index
    47.                 if (gridObj[x,y] == null)
    48.                 {
    49.                     emptySpaces++;
    50.                 } else {
    51.                     if (emptySpaces > 0)
    52.                     {
    53.                         Transform objTransform = gridObj[x,y].transform;
    54.                         float dist = objTransform.position.y - (y + posOffset - emptySpaces);
    55.                         gridObj[x, y - emptySpaces] = gridObj[x,y];
    56.                         gridObj[x,y] = null;
    57.                         fallSequence.Insert(y/10f, objTransform.DOMoveY(y + posOffset - emptySpaces, dist/yVelocity).SetEase(Ease.OutBounce));
    58.                     }
    59.                 }
    60.             }
    61.         }
    62.         fallSequence.OnComplete(()=>
    63.                                 {
    64.             FillGrid();
    65.             print("compress completed");
    66.         });
    67.     }
    How to make sure once all of the tween inside the sequence done, the callback stop? Right now it keeps printing those messages, eventhough all the object are idling.
     
    Dudu_tm likes this.
  17. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    @Izitmee, never mind the post above, apparently the function playerInput.CheckAfterFall(); on line 30 was causing the loops, after fixing it, it runs flawlessly, Thanks again for the awesome DOTween plugin :)
     
  18. M-Hanssen

    M-Hanssen

    Joined:
    Sep 8, 2014
    Posts:
    34
    I'm facing the problem when flying a camera to a certain point using DOMove and executing a LookAt tween at the same time, that the LookAt rotation is calculated according to the transform values before the DOMove action is executed.
    The desired effect would be that the tween would update the required rotation realtime as the DOMove tween is executing.
    Does anyone have a tip to achieve this?
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @romi.fauzi Sorry for being late, but glad you solved it in the meantime :)

    @M. Hanssen Mhmmm never thought of that. I can't test it now, but maybe you could use ChangeEndValue to update the DOLookAt while the DOMove is playing? Or if you're always pointing at the same target, you could just use a regular transform.LookAt inside the DOMove's OnUpdate callback.
     
    romi-fauzi likes this.
  20. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    Okay, I got another issues regarding callback, so below is basically a script for removing tiles from a list, here is the script:
    Code (CSharp):
    1. foreach (GameObject obj in killSet)
    2.                     {
    3.                         obj.name += "_m"; //for debugging
    4.                         gridManager.gridObj[(int)obj.transform.position.x, (int)obj.transform.position.y] = null;
    5.                         obj.transform.DOScale(targetScale, 0.5f).OnComplete(()=>tilePooling.RemoveTile(obj));
    6.                     }
    and this is the RemoveTile method from tilePooling script:
    Code (CSharp):
    1. public void RemoveTile(GameObject obj)
    2.     {
    3.         //obj.name += "_matched";  // < also for debugging
    4.         obj.SetActive(false);
    5.         obj.transform.parent = poolGroup.transform;
    6.         obj.transform.localScale = originalScale;
    7.  
    8.         switch(obj.tag)
    9.         {
    10.         case "Grid01":
    11.             listPool[0].Add(obj);
    12.             break;
    13.         case "Grid02":
    14.             listPool[1].Add(obj);
    15.             break;
    16.         case "Grid03":
    17.             listPool[2].Add(obj);
    18.             break;
    19.         case "Grid04":
    20.             listPool[3].Add(obj);
    21.             break;
    22.         case "Grid05":
    23.             listPool[4].Add(obj);
    24.             break;
    25.         }
    26.  
    27.         print ("Removed Tile: " + obj + " Time: " + Time.time);
    28.     }
    So the problem is, when the list consist 3 or more tiles, it will destroy each of the tile from the list, by tweening the scale each of the tiles, and then onComplete, executes the RemoveTile(tile) method. But when executing the RemoveTile method, somehow it only applies to the first tile in the list, and it can be confirmed by uncommenting the line:
    Code (CSharp):
    1. //obj.name += "_matched";
    It will add a suffix to only one tile name, but three times, instead to each of the tile/obj inside the list. On the other hand, the line:
    Code (CSharp):
    1. obj.name += "_m"; //for debugging
    Adding suffix correctly to each of the obj inside the list, so each of the obj get added "_m" on its name.

    And when RemoveTile is executed, only one tile get removed, and put back to the listPool, the rest tiles just stays on the shrink, get the scale tweened, but somehow RemoveTile on gets executed to the one tile from list, nth times depends on that list count (3 or more), I suspect the onComplete callbacks somehow only applies to first obj in the list, is there a way to fix this? Thanks a lot for any help before :)

    Edit: I've tried re-declare the gameObjects inside the foreach loop, but the problem its still there.
     
    Last edited: Aug 26, 2015
  21. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    Aha, apparently the parameter that is being passed to the method onComplete, should be the re-declared one also, finally got it working by changing the foreach loop, like below:
    Code (CSharp):
    1. foreach (GameObject obj in killSet)
    2.     {
    3.         obj.name += "_m";
    4.         GameObject tile = obj;
    5.         gridManager.gridObj[(int)obj.transform.position.x, (int)obj.transform.position.y] = null;
    6.         tile.transform.DOScale(targetScale, animDuration).OnComplete(()=>tilePooling.RemoveTile(tile));
    7.     }
    I posted the code, hopefully is useful for someone in the future.
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Damn, I never manage to answer before you answer to yourself :D That issue is related to this one.
     
  23. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    97
    Is there an easy way to append 2 tweens at the same time?

    Code (CSharp):
    1.     sequence = DOTween.Sequence();
    2.          
    3.             sequence.Append(text.DOFade(0f, .3f));          
    4.             sequence.Append(transform.DOMove(targetCenter.position, .2f));
    5.             sequence.Append(transform.DOScale(1f, .1f));
    6.             sequence.Append(transform.DOShakePosition(2f, 10f).SetEase(Ease.Linear));
    7.          
    8.             ////////////////// THIS 2 SHOULD PLAY AT THE SAME TIME
    9.             sequence.Append(top.transform.DOMove(targetTop.position, .2f));
    10.             sequence.Append(bottom.transform.DOMove(targetBottom.position, .2f));
    11.             ///////////////
     
  24. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Yes, go with Join ;)
     
  25. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    97
    Awesome! thanks!
     
  26. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    Yes exactly, after browsing through your web, I found that, and when I tried it at first, I passed the wrong variable....Nonetheless thanks again :)
     
  27. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi, can DOTween Pro set different speed for each waypoint? I'm using it to tween my boss but can't find a property like this in DOTween path. Maybe I should make a sequence instead?
     
    Last edited: Aug 27, 2015
  28. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    When I call .Complete() during the sequence tweening, .Restart() does not work in .OnComplete() callback

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DG.Tweening;
    4.  
    5. public class Test : MonoBehaviour {
    6.  
    7.     private Sequence mySequence;
    8.     void Start () {
    9.         mySequence = DOTween.Sequence().SetAutoKill(false);
    10.         Tweener tween1 = this.transform.DOMove(new Vector3(0,10,10), 2f);
    11.         mySequence.Insert(0, tween1);
    12.         mySequence.OnComplete( () => {
    13.             Debug.Log("OnComplete");
    14.             mySequence.Restart();
    15.         });
    16.     }
    17.    
    18.     void OnGUI()
    19.     {
    20.         if ( GUI.Button(new Rect(0,0,100,100), "Play") )
    21.         {
    22.             mySequence.Play();
    23.         }
    24.  
    25.         if ( GUI.Button(new Rect(0,100,100,100), "Restart") )
    26.         {
    27.             mySequence.Restart();
    28.         }
    29.  
    30.         if ( GUI.Button(new Rect(0,200,100,100), "Complete") )
    31.         {
    32.             mySequence.Complete();
    33.         }
    34.  
    35.     }
    36. }
     
  29. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    What is the proper way to warm up a tween via code? I am "sliding" three buttons along the X axis onto the screen when the user presses a different button. The first time they slide onto the screen there is a very noticeable lag. Subsequent slides are as smooth as butter.

    Doing this for each button:
    Code (CSharp):
    1.             button.transform.DOMoveX(target.transform.position.x, ButtonDuration)
    2.                 .SetDelay(delay)
    3.                 .SetEase(Ease.Linear)
    4.                 .OnComplete(() =>
    5.                 {
    6.                     _animatingButtons = !stopAnimating;
    7.                 });
     
  30. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    92
    Hi,

    When using safeMode = false.

    I have a DOTween that is moving a transform with loops set to -1, and that transform is being destoryed on collision.
    I'm getting the following exception:
    MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.

    Why doesn't DOTween check if the object is null? before animating it, even if safeMode is false?

    Using unity cloud build, it always sets safeMode to false, and it would be good if such things could be avoided by the framework, even if I didnt kill the animation explicitly.
     
  31. Clemens Gao

    Clemens Gao

    Joined:
    Aug 31, 2015
    Posts:
    1
    Hi, I find that I can't decompress the example package downloaded from your website. I am using Unity 5.1.2f. Where can I get a valid package?
     
  32. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    495
    Can this be use for racing game? including calculating rank ,different speed etc?
     
  33. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    It really depends on what kind of racing game you're making. DOTween can set tweener base on speed and return lots of info you want. I mean, if you want to scroll your background or make cars move simply, that's ok. But in most case, if you want to make a "normal" racing game, you have to deal with lots of physics like collision, rigidbody, friction etc. I bet you want to consider these first :)
     
    Last edited: Sep 1, 2015
    idurvesh likes this.
  34. ArmelGibson

    ArmelGibson

    Joined:
    Jul 4, 2015
    Posts:
    8
    Hey everyone, I'm crossposting from the Demigiant forum because I think I stumbled upon a bug that was supposed to be fixed.

    I keep getting these issues, where at the start of a new scene these errors will randomly pop up:



    First one is:
    And second one:
    In both cases, I'm starting a standard tween in a Start() function. Now I'm under the impression that if I put something like
    Code (CSharp):
    1. DOTween.SetTweensCapacity(999999, 100);
    at the start of a scene, it reduces the probability of the error happening (but sadly doesn't totaly solve the issue). It's super random, and I can sometimes load the scene 20 times in a row without any issue, and sometimes it's the first time I launch the game :<

    I'm using the latest DOTween version, v1.0.810
     
  35. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    I'm experiencing this also, although the message was a bit different, and it happens on runtime, when it happens, I'll need to reimport all, and that will fix it, is there a fix for this?
     
  36. ArmelGibson

    ArmelGibson

    Joined:
    Jul 4, 2015
    Posts:
    8
    Update, I sometimes get this one too...

     
  37. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Hi I'm having some issues with object orientation on complex paths.

    Im sending multiple objects each with there own DOPath along the same waypoint path using DoPaths's .fullPosition.

    I want the behaviour whereby all objects that pass a certain point on the path to be facing the same direction at that point, however over time the objects take on new orientations and point various ways, see in in the below video.



    Any ideas about why this behaviour is happening?

    Thanks

    Here's my code:


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3. using DG.Tweening;
    4. using SWS;
    5. public class TweenGroup : MonoBehaviour
    6. {
    7.     //public PathManager pathMan;
    8.     public PathType pathType = PathType.CatmullRom;
    9.     public bool closeWaypointLoop;
    10.     public Transform prefab;
    11.     public int noOfObs;
    12.     public Vector2 randomScale;
    13.     public float speed;
    14.     private Vector3[] waypoints;
    15.     private float timeValue;
    16.     private Tween t;
    17.     private List<Transform> prefabPool = new List<Transform>();
    18.     private List<Tween> tList = new List<Tween>();
    19.     void Start()
    20.     {
    21.         BuildObs();
    22.     }
    23.  
    24.     void Update()
    25.     {
    26.         MoveGroupAlongPaths();
    27.     }
    28.  
    29.     void BuildObs()
    30.     {
    31.         PathManager pathMan = this.gameObject.GetComponent<PathManager>();
    32.         waypoints = pathMan.GetPathPoints();
    33.         for ( int i = 0; i < noOfObs; i++)
    34.         {
    35.             Transform prefabOb = Instantiate(prefab, waypoints[0], Quaternion.identity) as Transform;
    36.             prefabOb.transform.parent = this.transform;
    37.             float theRandomScale = Random.Range (randomScale.x,randomScale.y);
    38.             prefabOb.transform.localScale = new Vector3(theRandomScale,theRandomScale,theRandomScale);
    39.             prefabPool.Add(prefabOb); // prefab pool is uneccessary but might be useful for later on in the programming
    40.             t = prefabOb.DOPath(waypoints, 1, pathType) //set it to 1 so it will take a second to complete
    41.                 .SetOptions(closeWaypointLoop) // this closes the loop and lets it become loopable
    42.                 .SetLookAt(0.0f); // this is how far for the object to loko ahead to turn, smaller numbers sharper turns
    43.             t.SetEase(Ease.Linear).SetLoops(-1);
    44.             t.Pause();
    45.             tList.Add(t);
    46.         }
    47.     }
    48.     void MoveGroupAlongPaths()
    49.     {
    50.         for ( int i = 0; i < tList.Count; i++ )
    51.         {
    52.             float basePercent = i * (1.0f / tList.Count);
    53.             float finalPercent = (basePercent + timeValue);// % 1.0f; // loop over 0-1 range
    54.             //Debug.Log (finalPercent);
    55.             t = tList[i];
    56.             t.fullPosition = finalPercent;
    57.         }
    58.         timeValue += Time.deltaTime * speed;
    59.     }
    60. }
     
  38. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi lzitmee, how about integrate shortcuts with "Colorful FX"? So many values there and it must be more efficient if DOFloat works :)
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    WTF! Why the forum sometimes stop sending me notifications, agh! Sorry ladies and gentlemen, here are some late answers:

    @zhuchun Ah! I do have Colorful FX and it's awesome. I'll think about that :)
    About the waypoint speed, nope, that can't be done. But you can trick it, by getting the path tween (via myDOTweenPath.GetTween()), adding an OnWaypoingChange callback to it, and changing (or tweening) the tween's timeScale when a given waypoint is reached.

    @wxxhrt That is weird. Could you create a sample project to test it out and send it to me, so I can check it better?

    @ArmelGibson @romi.fauzi Damn, I thought I fixed that ages ago. That is an error I can't manage to reproduce, so it would be great if one of you could reproduce it and send me the project, so I can finally squash it.
    In the meantime, the solution should be to simply set a high tween capacity (don't worry, performance won't be affected), like @ArmelGibson did, but involving also the Sequence capacity:
    Code (csharp):
    1. DOTween.SetTweensCapacity(10000, 5000); // or even higher if you have more tweens
    @Clemens Gao If you're trying to import it directly via Unity, you have to decompress it via your system's unzipper.

    @jprocha101 Hi. First of all, if you're tweening a UGUI button, I'd recommend using DOAnchorPos (via a RectTransform), which is much more efficient. Otherwise, you could check the "Smooth DeltaTime" option in DOTween's Utility Panel, which should make things smoother overall (the initial hiccup is usually due to Unity realizing that something is moving and updating stuff around it, not to the tween itseld, so a warmup would be useless).

    @kobyle That's what safeMode is for, so that everything is less safe (meaning the user needs to take more care) but faster. If Unity Cloud somehow deactivates safe mode (though that shouldn't happen: you're probably not committing DOTween's settings file), you can activate safe mode at runtime with useSafeMode.

    @yuewahchan Weird, gonna check that out. But why not use a simple infinite loop, instead than setting up a Restart inside OnComplete?
     
    zhuchun likes this.
  40. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    This may be a strange use-case I've got here, but is it possible to do the string scramble tween, but only from a certain index forward?

    Basically I've got a string with a prefix, but I don't want to scramble the prefix -- only what comes after it. I'm not sure if this is possible, but I figured I'd ask to see if you, or anyone else, has any thoughts.

    As a fallback I guess I could have two separate strings, the prefix and the main string, and only tween the main string, but I'd rather keep everything in one string if I can, as it'll be significantly easier to work with.

    Any thoughts?
     
  41. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hm, interesting thought. I didn't try this before, but I will use separate strings to do this job. Because language have grammar, say I'm building games in English,Japanese and Chinese, and in most case their word order is totally different. So separate strings may more handy somewhat.
    To this issue, how about String.Format()? Is it a bit easier?
    Code (CSharp):
    1. string mainStr="Hello world ";
    2. string wholeStr= String.Format("I print {0} today", mainStr);
    3. //tween mainStr and assign value OnChange
     
  42. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    92
    Heya,

    Thanks for the reply, but just to be sure:
    What if Unity Cloud Build sets Script Call Optimization to "Fast but no Exceptions".

    On that case, if I set safeMode = true, will it still make any difference?

    Koby
     
  43. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    Where can I send my repro project?
     
  44. anuj

    anuj

    Joined:
    Jun 15, 2015
    Posts:
    28
    is there any way to use DoPath starting from certain percentage of path , for example starting path from midway

    Code (CSharp):
    1. Tween ballTween=transform.DOPath(manager.LevelPath,speed,PathType.CatmullRom).SetSpeedBased().SetLookAt(0.01f).Pause();
    2.  
    3. ballTween.ForceInit();
    4.  
    5. transform.position= ballTween.PathGetPoint(0.5f);
    6. ballTween.Play();
    but this makes the ball to start from start of path and not the halfway
    i also used ballTween.fullPosition=.5f; but it sets position based on duration of path and not the percentage along path , so it will place the ball where it will be after .5 second and not half way on the path
     
    Last edited: Sep 7, 2015
  45. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
    I finally able to fix the issue without recompiling the projects, by changing the method that calls the SetTweensCapacity method from Start to Awake. Now I don't need to recompile the project every now and then.
     
  46. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Thanks Izitmee, I'll PM you a link to the package as it contains SWS.
     
  47. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Hi,
    Is there a way to stop an infinite loop, making sure that it returns the transform to it's original starting position (in the case of DOScale? Kill stops it, but the object stops at the scale at that time, not it's original scale. Not sure what to do.


    Cheers
     
  48. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    @juicymangoz will chaining a .OnComplete where you change the transform position to the original work in your situation?
     
  49. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Yes I've just done this and it works (so when the object is touched again, it turns off the scale loop):
    Code (csharp):
    1.  
    2. transform.DOKill();
    3. transform.DOScale( originalScale, 1f);
    4.  
    I guess this is fine - not sure if it's the most efficient way, but it works.
     
  50. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Try this?
    Code (CSharp):
    1.    
    2. //play
    3.         Tween _tween= transform.DOScale(5, 1f);
    4.         //pause or kill
    5.         _tween.Pause();
    6.         //revert
    7.         _tween.PlayBackwards();