Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

DOTween (HOTween v2), a Unity tween engine

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

  1. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    260
    If I want to:
    Code (CSharp):
    1. numberToTween.renderer.material.DOFade (0f, 1f).SetEase (Ease.OutQuint);
    But if I want to assign the value before the tween is completed ( 1f ) back to numberToTween, do I need to use the .From() ? I tried it but didn't quite work the way it is supposed to.

    Any ideas?

    Thanks
     
  2. Indiefreaks

    Indiefreaks

    Joined:
    Nov 12, 2012
    Posts:
    64
    Not sure it is a bug or not yet I'm facing an issue while using DOTween sequences.

    Here is the repro:
    Create a new sequence and add just AppendCallback calls.

    While I was expecting the callbacks to get called, nothing happens at all.

    The sole way for me to make them being called actually is by using an Append() call passing a Tween to it.

    Seems like Sequence doesn't work if only using AppendCallbacks and AppendIntervals.

    Would be great to let it happen thow.

    Thanks for the lookup... ;)
     
  3. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Little Big Monkey Hi! In order:
    - You certainly can and I actually recommend it, unless you're using path tweens which are the only part still truly in alpha
    - No migration tool sorry. But I replaced HOTween with DOTween in my game Goscurry (which uses tons of tweens) and it took just a little more than an hour. Considering I'm probably the fastest DOTween user (I hope) it still shouldn't take much.
    - No visual editor for now, nor I plan to make one. Maybe in the future

    @gegagome If you add a From your material fade value will immediately jump to 0 (the end value you added), then animate back to the value it had before it jumped to 0. Everything works correctly here, what's happening there instead?
    P.S. to simply assign the final value of a tween before it's complete instead you can simply use Complete.

    @Indiefreaks Ah you're right, Sequences composed only of callbacks don't work because they're not really tweens :p But I added it to my todo list and I'll see if I can add the feature within Wednesday.
     
  4. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    27
    Hi I am trying a simple test, I have a cube and when i click it I want it to rotate along one axis 90o. This works initially but at a certain point DoTween tweens the other axis's to create the same rotation/quaternion. This results in a strange animation, would anyone be able to help me out?

    Code (CSharp):
    1. void OnMouseUp () {
    2. float destX = transform.rotation.eulerAngles.x + 90.0f;
    3. transform.DORotate (new Vector3 (destX, 0.0f, 0.0f), 0.5f, true );
    4. }
     
  5. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    Hi aholla,
    Try this, it works fine for me.

    Code (CSharp):
    1. public class TestObj : MonoBehaviour
    2. {
    3.     Tween tapPunch;
    4.  
    5.     void Start ()
    6.     {
    7.         tapPunch = gameObject.transform.DOLocalRotate (new Vector3 (0, 90, 0), 1).SetAutoKill (false).Pause ();
    8.     }
    9.  
    10.     void Update ()
    11.     {
    12.         if (Input.GetMouseButton(0))
    13.             tapPunch.Restart();  
    14.     }
    15.  
    16.     void OnDisabled()
    17.     {
    18.         tapPunch.Kill (); // Dont forget to kill when not needed anymore. Needed only if SetAutoKill (false) is set.
    19.     }
    20. }
     
    Izitmee likes this.
  6. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    733
    Hi while testing Dotween vs itween, i noticed that while i was moving transforms that had a rigidbody, dotween seemed to use up 50% cpu ussage in the profiler, while itween was down to 2%. Do objects with rigidbodys get handled differently than objects that have no physics? Also i believe itween used FixedUpdate (which is conveniently what physics use for rigidbodys) and it appeared dotween used Update.
     
  7. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @tripknotix If you want to tween a rigidbody correctly you should tween the rigidbody directly (so that it uses specific rigidbodies methods). I can't test it right now, but could you try it and let me know if everything's alright like that?
    Code (csharp):
    1. myRigidbody.DOMove(...);
    2. // Instead of
    3. myRigidbodyTransform.DOMove(...);
     
  8. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    27
    Hi YaVeTal,

    thanks for your solutions but it doesnt solve the issues im getting. What happens is:

    When i rotate by 90 it is fine, 180 it is fine but when it is 270 the cuble spins/flips on all axis to get to the correct rotation. The end result is fine but I need it to ONLY rotate the x axis.

    So when i click the club, it rotates 90 (along x), i click it again and it rotates 90 (along x) and when I click it again it spins around but ends up with the correct face but the rotation on the object is now ( 0, 180, 180), I would like it to be ( 270, 0, 0).

    Any ideas how to do this??
     
    Last edited: Nov 5, 2014
  9. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    Im using Photon in conjunction with DOTween, however i have come across some odd behaviour when photon disconnects from a joined room...Movement tweens stop interpolating. the tween get's called but it does not move for the entire duration, and then at the end just jumps to the end value. However this only seems to as far as i can tell happen on my positional tweens, rotation seems fine, i have not tested this against any other teens...Any ideas?

    Update:

    So i tried to test a bunch of other tweens on a transform sprite i added to the scene to see if they were affected by this same issue...and it exhibits none of the odd behaviour aforementioned...even the movement tweens...they work perfectly fine. such confuse

    Update 2:

    It is nothing to do with photon it was again to do with NGUI and it's anchoring system after deactivating and reactivating the objects. will post on NGUI forums to see if a solution can be obtained.
     
    Last edited: Nov 6, 2014
  10. chlagou

    chlagou

    Joined:
    Jan 15, 2014
    Posts:
    5
    Hi,
    Can I Update the path waypoints after the execution ?

    thanks
     
  11. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Oops sorry for the late reply, but I didn't get the last mail notifications.

    @aholla Rotation in 3D space and Quaternions is not as simple as rotating a single axis (because otherwise you would get gimbal lock issues and stuff like that). So DOTween takes care of rotating in the correct direction, but what you see in the Unity inspector is the rotation you applied (in Vectors) converted into Quaternions (because that's how it works), then reconverted to Vectors by the Inspector (or any other conversion method). You'll see that even if you rotate manually things in the Inspector, you might end up (after releasing the mouse), with different final converted axes. No solution for that.

    @Nemial Sorry if I couldn't come to help sooner, but glad you pinpointed the real issue in the meantime! :)

    @chlagou Sorry but no: once waypoints are created they stay fixed (because there's an initial calculation that needs to be done in order to tween things faster).
     
  12. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    @Izitmee
    I have pinpointed the problem indeed, however the owner of NGUI could not really provide a definitive solution to my ails. So i have resorted to instead of deactivating objects...setting them to invisible and making sure update is not called while they are invisible...this has, as i suspected had some odd things happening as things which used to be inactive are now making calls they should not etc.
     
  13. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    733
    having changed it to use rigidbody, definitly decreased cpu ussage to a very low number. Another performance hog may have been a cause of Dotween not overriding the same way itween does, for example, i was moving a player to a position over an amount of time, and in the middle of its movement i received another position update, so i would create another dotween and this would cause unwanted behavior and sometimes no movement at all till one of the actions completed.

    So i call "DoKill" on each rigidbody. which appears to fix the problems i was having with both dorotation and domove in 1 go.

    I'm sure there is probably a better solution to "update" the target position for the domove / dorotations but im not sure how to check if i need to do an update, or if i need to create a new one.

    This was handled behind the seens in itween. But its down to 2% or less cpu ussage for dotween =) thanks for that.
     
  14. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Nemial glad you, uh, kind of fixed it. Maybe you could try asking Aren if there's a way to simply deactivate anchors, unrelated to tween engines (I never used NGUI so I can't help with it).

    @tripknotix Glad it works correctly :) DOTween doesn't do the same "behind the scenes" thing iTween does with rigidbodies because it has an object approach, contrary to iTween's gameObject one. That means DOTween has no idea (nor doesn't want to, because it's bad for performance :p) if your target has a rigidbody attached or not unless you tween that directly. The positive side of this is performance and garbage collection (since there's no need to attach a tween MonoBehaviour to each gameObject).

    EDIT @Nemial by the way, not to dismiss NGUI, which is/was a great system (from what I read), but the new Unity 4.6 UI is awesome, and I'm having no problems animating it (though I'm doing different things than you). You might want to try it.
     
  15. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,676
    Izitmee, any plans of update soon?
     
  16. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @MrEsquire No known bugs at the moment plus I was travelling so I'm going slow this week and no updates until next Monday at least, probably (with some minor new features) :p
     
  17. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    61
    Hi, i just started with Unity and DOTween, and i have problem with animating a transform.position property.
    All works fine, but onComplete, the position.y is a bit off no matter what i do. Im animating MainCamera position.

    example code:
    Code (CSharp):
    1. public class CameraControl : MonoBehaviour
    2. {
    3.     // camera to follow "target"
    4.     public Transform target;
    5.     public float distance = -10f;
    6.     public float targetHeight = 1.5f;
    7.  
    8.     private bool initialized = false;
    9.  
    10.  
    11.     void Start ()
    12.     {
    13.         // global initializations of stuff
    14.         DOTween.Init(false, true, LogBehaviour.Verbose).SetCapacity(200,10); // autoKillMode, useSafeMode, logBehaviour
    15.      
    16.         // animate camera position over time from onstage position to following:
    17.         transform.DOMove(target.position + new Vector3(0, targetHeight, distance), 2).OnComplete(()=>initialized=true);
    18.     }
    19.  
    20.     void Update ()
    21.     {
    22.         if (initialized)
    23.         {
    24.             // traces: 0, 3.345876, -6
    25.             Debug.Log (transform.position.x+", "+transform.position.y+", "+transform.position.z);
    26.  
    27.             // persistent camera follow player
    28.             transform.position = target.position + new Vector3(0, targetHeight, distance);
    29.  
    30.             // traces: 0, 2.48, -6 (and repeats)
    31.             Debug.Log (transform.position.x+", "+transform.position.y+", "+transform.position.z);
    32.         }
    33.     }
    34. }
    So basically the first time Update triggers, we can see that the transform.DOMove animated to y-position of 3,345876 instead of (correctly) 2.48.

    Ideas?
     
    Last edited: Nov 7, 2014
  18. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @_watcher_ I jujst rechecked to be sure nothing broke, but I can confirm that a tween completes at the exact value you set, and OnComplete reports that. I suppose something is happening and moving either your target or your transform between your tween's completion and the Update call.
     
  19. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    Hi @Izitmee Sorry for resurrecting that old pet peeve but I still have problems with the "[DOTween]" object not being properly cleared from the scene. I noticed it always happens when any error (completely unrelated to DOTween) pops up in the console and then I stop the game.

    At that point a message "Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)" appears, followed by a couple of errors saying "!IsPlayingOrAllowExecuteInEditMode ()".

    Bottom line is the "[DOTween]" object is not destroyed when I exit game mode. At first sight it looks like the method you're using relies on the game not meeting any error...? Anyway I hope that info helps you squash that bug once and for all!

    EDIT: Mmh it seems this actually happens even without errors popping up...
     
    Last edited: Nov 8, 2014
  20. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi @Seith. Damn that is very annoying. I'm using DOTween on a new mini-game plus Goscurry and even if I get errors I never encounter this bug. About the EDIT, are you sure you didn't just misread an old DOTween leftover from a previous error? That would be superweird.

    Some info to try and squash this bug once for all (and sorry if it still happens). I assume you do have some tween being created inside an OnDestroy. Could you post a snippet of one of those OnDestroys? Also, could you post a screenshot of the log? Also, do you have the latest latest version of DOTween (0.9.220 - I assume you have, but I have to ask :p)

    Thanks, and we will prevail :) Consider I might be slow to fix it this weekend since I'm completing a project and seeing parents (help!), but I'll be on it from Monday.
     
  21. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    Well apparently I was on 0.9.190 so I upgraded to 0.9.220 and I'm going to test some more. I'll let you know if it does take care of the problem.

    And to answer your question I don't use any "OnDestroy()" method anywhere in my code (which is why I was really puzzled by that error message). Anyway, enjoy your weekend...! :)
     
  22. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hello nice users. Just wanted to announce that I just implemented ease for Sequences. Meaning that applying an ease to a Sequence will now ease the whole Sequence as if it was a single animation. It is very powerful and allows for great effects if used correctly, and I'm currently loving it. Still in alpha but I'll release this week :)
     
    YaVeTaL and MrEsquire like this.
  23. WinSpur

    WinSpur

    Joined:
    Nov 10, 2014
    Posts:
    5
    Hi, In case HOTween, GetPointOnPath was good!
    But, DOTween does't support GetPointOnPath ?
    I can't find.
    Is there any way to get position(Vector3) ?
    Sorry for poor English!
     
  24. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi @WinSpur,

    just answered your mail: gonna implement something like GetPointOnPath in the future, but first I have to complete the path plugin (which is the only alpha element at the moment).
     
  25. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    NEW UPDATE 0.9.310
    • NEW: transform/rigidbody.DORotate now has an additional option RotateMode which allows to choose if you want a regular, a beyond 360, an "add to world-axis" or an "add to local axis" rotation
    • NEW: Sequences now support Ease, which will be applied to the whole Sequence
    • NEW: Added Rigidbody2D shortcuts
    • NEW: Added audioSource.DOFade/DOPitch shortcuts
    • CHANGE: transform/rigidbody.DOLocaAxisRotate removed and replaced by an additional RotateMode option in DORotate
    • BUGFIX: Implement correct DOLookAt for rigidbodies
    • DOTweenSetup command updated

    BEWARE THE API CHANGE

    DORotate is now much more powerful with its new RotateMode option, but DOLocalAxisRotate doesn't exist anymore, because it's simply been replaced by:
    Code (csharp):
    1. myTransform.DORotate(new Vector3(0,90,0), 1, RotateMode.LocalAxisAdd);
    I'm sorry for the API change, but I think this is a big readability/usage improvement so I did that :)
     
    Last edited: Nov 12, 2014
  26. Lumen-Digital

    Lumen-Digital

    Joined:
    Aug 3, 2012
    Posts:
    13
    Hi

    DOTween is awesome! Thanks for all of your hard work.

    I am trying to pass both a call back and parameters to the tween but am getting an error:
    parameters do not match delegate `DG.Tweening.Core.TweenCallback()' parameters
    When attempting:
    public void MoveTo( Vector3 pos, float duration, DG.Tweening.Core.TweenCallback callback, object paramaters)
    {
    transform.DOKill();
    transform.DOLocalMove(pos, duration).SetEase(Ease.InOutBack, 0.5f).OnComplete(()=>callback(paramaters));
    }

    The parameters will work when calling a local method and not specifying them as an object.

    Any suggestions?
     
  27. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi @Lumen Digital, glad you like it :)

    The TweenCallback delegate accepts only a method with no parameters. To pass a method with more than one just use an Action instead:
    Code (csharp):
    1.  
    2. public void MoveTo( Vector3 pos, float duration, Action<object> callback, object parameters)
    3. {
    4.    transform.DOKill();
    5.    transform.DOLocalMove(pos, duration).SetEase(Ease.InOutBack, 0.5f).OnComplete(()=>callback(parameters));
    6. }
    7.  
     
  28. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    DOTween and NGUI Widget's with anchors Hotfix

    So i stumbled upon something that makes them play nicely together, you can read more about the harrowing journey here, the fix is also in there but i will put it here for reference.

    N.B There is a parameter for callbacks in the function signature because the function already uses OnComplete to make NGUI do it's business of updating the anchors. Adding onComplete to my extension functions will override it and it will never get called, making your tweens jump back to their starting position, and all sorts of other mess, don't be that man/woman/child/extraterrestrial-toaster-kin

    Example usage:
    Code (CSharp):
    1.  
    2. CasualButton.transform.DOLocalMoveXWidget (-125, 0.5f,()=>{CasualButton.collider = false};);
    3.  
    Pro/Amatertip: they are extensions of transform so it may be best to add them under a static class and namespace.

    Code:
    Code (CSharp):
    1.  
    2. public static Tween DOLocalMoveWidget (this Transform target, Vector3 endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
    3. {
    4.     UIRect rect = target.GetComponent<UIRect>();
    5.     UIRect.AnchorUpdate defaultUpdateFlag = UIRect.AnchorUpdate.OnUpdate;
    6.  
    7.     if(rect != null)
    8.     {
    9.         defaultUpdateFlag = rect.updateAnchors;
    10.         rect.updateAnchors = UIRect.AnchorUpdate.OnEnable;
    11.     }
    12.  
    13.     return DOTween.To(()=>target.localPosition,x=> target.localPosition = x,endValue,duration)
    14.         .OnComplete(()=>{TweenPosition.Begin(target.gameObject,0,endValue).PlayForward();rect.updateAnchors = defaultUpdateFlag;if(callback!= null)callback();});
    15. }
    16.  
    17. public static Tween DOLocalMoveXWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
    18. {
    19.     Vector3 endPosition = target.localPosition;
    20.     endPosition.x = endValue;
    21.  
    22.     return target.DOLocalMoveWidget(endPosition,duration,callback,snapping);
    23. }
    24.  
    25. public static Tween DOLocalMoveYWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
    26. {
    27.     Vector3 endPosition = target.localPosition;
    28.     endPosition.y = endValue;
    29.  
    30.     return target.DOLocalMoveWidget(endPosition,duration,callback,snapping);
    31. }
    32.  
    33. public static Tween DOLocalMoveZWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
    34. {
    35.     Vector3 endPosition = target.localPosition;
    36.     endPosition.z = endValue;
    37.  
    38.     return target.DOLocalMoveWidget(endPosition,duration,callback,snapping);
    39. }
    40.  
     
  29. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Nemial Sweet! Congrats for the persistence and the solution :) I just posted a link to your post in DOTween's FAQ.
    By the way, seeing your solution I had an idea. Maybe regular DOTween shortcuts could work without hacks if you set the update to LateUpdate (UpdateType.Late)? You could give it a try.
     
  30. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    through a quick try two different ways, the first time it did work and the second it did not. I may experiment with it later, and also keep it in mind for future endeavours.
     
  31. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,676
    I forgot to ask, have you tested on Unity 5 beta and all is ok?
     
  32. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @MrEsquire I didn't (because I don't have it) but others have and it works without any issue (just WebGL export has issues, but Unity recognized it's their problem and they're fixing it) :)
     
    MrEsquire likes this.
  33. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    74
    Hello Izitmee,

    A little question;

    I've setup a tween that loops infinitly and has a delay. Is it possible somehow to start the tween immediatly and start using the delay at the second loop?

    Greetz,
    G
     
  34. Lumen-Digital

    Lumen-Digital

    Joined:
    Aug 3, 2012
    Posts:
    13
    Thank!

    And here is another question;

    What is the best way to prevent multiple tweens from being called on an object?

    Here I am tweening the rect 'windowRect':

    DOTween.To(()=> windowRect, x=> windowRect = x, targetWindowRect, t).SetDelay(delay).SetEase(Ease.InOutQuad).OnComplete(ShowComplete);

    Is it a case of storing a reference to the tween to prevent multiple tweens acting on the rect ie:
    rectTween = DOTween.To(()=> windowRect, ...

    This seems to work, but should I be doing something like:
    DOTween.Kill(windowRect); - This doesn't seem to have an effect.
    or:
    rectTween.Kill(); - This could be redundant.

    I can actually call rectTween.Kill(); even if rectTween has not been initialised without causing a null reference error..

    Any clarification would be greatly appreciated.

    Thanks!
     
  35. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @gpvd The best way would be to create a Sequence, so you can add the interval at the end instead than at the beginning:
    Code (csharp):
    1. mySequence = DOTween.Sequence().SetLoops(-1)
    2.    .Append(myTween)
    3.    .AppendInterval(1);
    @Lumen Digital myTarget.Kill/Play/etc works only if you created your tween with a shortcut, not with the generic way. You could always use Ids or even better store the tween reference as your mentioned, then call
    Code (csharp):
    1. myTweenReference.Kill();
    which is what I do.

    rectTween.Kill doesn't throw exceptions even if rectTween is not instantiated on purpose. If you change the logBehaviour to Default you will get a warning instead.
     
  36. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    74

    Ok, Thanks for the awnser.
    Greetz,
    G
     
  37. Plumpman

    Plumpman

    Joined:
    Sep 7, 2012
    Posts:
    10
    Is there a setting I'm missing to fix this error? Its a simple NullReference, but it happens whenever I destroy a gameobject that has a tween currently on it, and it only happens on iOS.

    Am I doing something wrong? Do I have to .Init() with different settings?
     

    Attached Files:

  38. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Plumpman that's because the tween finds itself suddenly without a target. Do you have safeMode activated? That should take care of it. Otherwise, if you don't want to enable safeMode, you should kill the gameObject's tweens before destroying it.
     
  39. Plumpman

    Plumpman

    Joined:
    Sep 7, 2012
    Posts:
    10
    Just wondering because HOTween never had this error, and we are tweening in the same way.
    Just assumed it would clean tweens automatically.

    I do have safemode on (default .Init() call) and it still has those errors on iOS. Should it not?

    Thanks for the quick response btw!
     
  40. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    This is weird because HOTween didn't clear tweens automatically: it's a new feature only DOTween has. Can you show me the tween code you're using for that specific case? Also, are you sure it's due to DOTween and not, for example, the content of an OnComplete callback?

    P.S. yes, safeMode should be on
     
  41. Plumpman

    Plumpman

    Joined:
    Sep 7, 2012
    Posts:
    10
    For example, I have an tween playing to open an invite, but I can close out of it sooner and just kill all the invites while they are tweening. It seems as though its trying to find those invites that aren't there, but this was never an issue in HOTween.

    Remember, this ONLY happens on iOS. The editor is fine, no errors pop-up, which is also weird.
    I'm testing on a iPad Mini 7.1.1.
     

    Attached Files:

  42. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Superweird, I would totally expect that to possibly create issues with HOTween but not with DOTween. Also weird that the editor is fine but not the iOS build, since I just use try..catch blocks to determine if there's an error (like missing targets) and eventually clean the tween, and that stuff should work without fault on any platform. Tomorrow morning I'm going to inspect the whole safe routine again and see how I can solve this.
     
  43. Plumpman

    Plumpman

    Joined:
    Sep 7, 2012
    Posts:
    10
    Thank you very much! Hopefully you have some findings tomorrow, best of luck.
     
  44. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    I found the reason. Apparently settings the iOS stripping level to anything but "Strip Assemblies" breaks any Try-Catch exception handling (see thread here), and thus safeMode won't work, ouch! The safeMode heavily relies on the try-catch system (anything else would make things much slower) so I can't fix it on my side, sorry for that. The two solutions would be to:
    1. Set the stripping level to "Strip Assemblies" and thus allow safeMode to work correctly
    2. Deactivate safeMode and take care of killing any tweens before killing their targets (in your case you should store the Sequence somewhere and call mySequence.Kill before destroying the gameObject, or you could add an ID to it and use DOTween.Kill(myId)).
     
  45. Plumpman

    Plumpman

    Joined:
    Sep 7, 2012
    Posts:
    10
    Thanks for the findings! I messed with the Optimization settings a bit and found slightly different findings.

    I was able to keep the stripping level at "Strip ByteCode".
    I only had to change the Script Call Optimization to "Slow and Safe".

    Now it works great!
     
  46. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Oh cool! Good to know, from that thread it seemed nothing would change with Script Call Optimization, but I'm glad it now works. I'm gonna update the documentation to reflect that :)
     
  47. mlabarca

    mlabarca

    Joined:
    Jan 22, 2014
    Posts:
    5
    Hi, I've been trying to use Dottween to make a looping animation of an object rotating around its z axis. The code I did looks like this:

    rotateTween = transform.DOLocalRotate(new Vector3(0f, 0f, -180f), 5f, RotateMode.Fast);
    rotateTween.SetLoops(-1, LoopType.Incremental).SetEase(Ease.Linear);

    While the rotation does happen it seems really jittery and shaky so I changed back to a Mecanim animation where it looks fine. Am I doing something wrong? the object itself is a 4.6 UI Image.
     
  48. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi @mlabarca, the code is correct and there should be no issues. I broke my Unity 4.6 yesterday though and am on Unity 4.5, but I'll reinstall to try and replicate the issue. Might take me until Monday though, because I'm deep into the Game Jolt jam until then :p
     
  49. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    276
    So I'm waiting to migrate to DOTween from HOTween until the pathing is in. I'm a heavy user of HOTween paths, but they are kind of primitive. I use the HOPath script which is not part of the regular HOTween package, and have heavily modified it. I have a list of features I'd like:

    * Per node callbacks. I'd like to be able to execute a method when the object reaches a node in a path.

    * Per node rotation, scale. Instead of having just the position interpolated between path nodes with the option of facing or not facing the next node, I'd like the ability to apply a rotation and scale to each node and have the object on the path tween between those as well as the position.

    * Caching. Also, is it possible to cache the paths so that if you have like 50 objects moving along one path, there doesn't need to be 50 instances of that Tween? Or at least 50 allocations of the path points?
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,028
    Hey @quitebuttery,
    just in case you've missed my asset Simple Waypoint System - besides waypoint movement for NavMesh agents, it comes with a few movement scripts built on top of HOTween and path creation tools / sharing as well as an interface for method calls at waypoints. I've collaborated with Izitmee on (ideas for) the path plugin, and I'm sure that DOTween (Pro) + SWS will be even more awesome in the future :)