Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee how to change the waypoint in realtime?
     
  2. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    @all

    If one of you guys should get ever the errors I got. Don't forget to setup DOTween through the Utility Panel!
    You'll find it under the Tools-Menu. If the submenu (DOTween Utility Panel) doesn't show up, restart Unity.
    Then run the Setup. At least that did the job for me.

    As always @Izitmee provided his great support :)
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @meapps Sorry but waypoints can't be changed once the tween starts. Waypoint Groups are an interesting idea for scrambling, and I'm adding it to my todo list, but I'm afraid it has very low priority for now.

    @BTStone Highfives :)
     
  4. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @ np i have troubles to change it before it started:
    tempy = Random.Range(-0.2f, 1f);
    path.wps[0].Set(0f, tempy, 0);

    seems not to work
    hopefully you know why.

    just want to change only one waypoint.
     
    Last edited: May 12, 2015
  5. Dragonic8926

    Dragonic8926

    Joined:
    Mar 10, 2014
    Posts:
    34
    That wasn't a problem for the mainTexture with material.mainTextureOffset, but I didn't find a solution for other textures (for example a normal map : http://docs.unity3d.com/ScriptReference/Material.SetTextureOffset.html with "_BumpMap") !
    For now I use OnUpdate for the mainTexture's tween in order to update the coordinates of my normal map !

    Maybe some new material shortcuts (for Tiling and Offset) with the texture property as parameter could be useful for a future version of DOtween ^^ !

    Edit : one other question about DOVirtual.DelayedCall ! Can't we use setLoop with it ?
     
    Last edited: May 12, 2015
  6. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    Some questions. I have bought PRO version, so, I have access to the path editor.

    We are creating a little platformer where we want to have something like spiky wheels following an horizontal or vertical path (at this point we are thinking just in a start and and end). Our game is tile based so, is there anyway to snap the waypoints to the tile size? In our case it is 64 and we want the waypoints to appear in the middle of each 64x64 tile. This will be greatly apreciate in edit more and will make us create levels much faster.

    On the other hand, has the path component any performance issue that could ruin our game frame rate when having 10-20 of them running at same time? (Yes, I will test it myself but prefer to have a first aproximation).

    Note: This is one of the plugins I have been using since 2010-2011 it is amazing. And a bargain at its current price.

    Cheers.
     
  7. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @meapps That can't be done either. But I'll think of a way to make it work.

    @Dragonic8926 I already added overloads for all material shortcuts that accept property names :) Check your IDE's intellisense, but in short you can do this:
    Code (csharp):
    1. myMaterial.DOOffset(offset, propertyName, duration);
    Hey @hexdump! Thanks for buying Pro! :) About snapping, there is none now, but I'll see if I can implement it somehow (not immediately though, because I have higher priorities in my todo list).
    About performance, using the visual editor is actually more performant than creating paths via script, because the visual editor serializes the full path, so it doesn't need to be initialized at runtime. That said, paths are much more heavy than a simple DOMove, but they should be performant enough to have no issue with 20 of them. Still, it depends on the platform's power (and the length of the path), so a test will be required indeed.
    Cheers!
     
  8. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
  9. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee thx for clear that up. I thought that i was too stupid to get it done^^
     
  10. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW DOTWEEN UPDATE 1.0.716

    • NEW: Added Transform/Rigidbody/2D DOJump shortcut
    • NEW: Many new Camera shortcuts
    • NEW: Added RectTransform.DOPunchAnchorPos shortcut
    • NEW: Added Material.DOTiling/DOOffset shortcuts
    • BUGFIX: Fixed IndexOutOfRangeException issue
    • BUGFIX: Fixed division by zero exception introduced in previous release
    • BUGFIX: Fixed incorrect number of removed files showing after DOTween Setup
    • BUGFIX: Fixed hyper-compatible version not working correctly with ChangeStart/End/Values
    • BUGFIX: Fixed DOTween Utility Panel not working on Windows if the project is inside a Documents folder that starts with a #
    DOJump! :)



    @meapps Nono, no one is stupid here!

    @hexdump A pleasure as always
     
  11. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Izitmee Great update thx, spritetween = _sprite.transform.DOPath(waypoints, duration, pathtype, pathMode, resolution, gizmoColor).OnComplete(TweenRewind); why can waypoints not changed before i restart it?

    There must be a way to change values....
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @meapps Changing waypoints is not allowed because, with path tweens, that would mean recreating the whole path. Which means that it's the same as creating a new DOPath, which is what you should do if you want to change them all :)
     
  13. DanielKhoroshko

    DanielKhoroshko

    Joined:
    Mar 11, 2015
    Posts:
    9
    Hello Izitmee.
    Could you help please to resolve the following issue.

    I have DOtween free included into the project that does a little tweening. After some tweening is done there is a [DOTween] GameObject left in the Hierarchy as usual.

    The problem is if I don't delete these object manually (in script) before Application.LoadLevel() and/or LoadLeveAsync() the game crashes if run on iOS. Other platforms work nice. It crashed just a frame before a new scene should be shown on screen... unfortunately after [DOTween] is deleted tween wouldn't work anymore.
     
  14. DanielKhoroshko

    DanielKhoroshko

    Joined:
    Mar 11, 2015
    Posts:
    9
    Let me clarify, it raises null reference exception, unfortunately I wasn't able to dig more out of xcode debugger. Using last version 1.0.716

    Thanks for a great asset
     
  15. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @DanielKhoroshko Hello!

    That is happening because one of your tweens' targets becomes null while the tween is still playing. DOTween's safe mode is built to take care of this, but on iOS works only if stripping level is set to "Strip Assemblies" or Script Call Optimization is set to "Slow and Safe" (because otherwise iOS strips all safety checks from the code, so there's no efficient way to take care of null references). You should either build your iOS app that way, or take care to kill your tweens before their targets become null.
     
  16. DanielKhoroshko

    DanielKhoroshko

    Joined:
    Mar 11, 2015
    Posts:
    9
    Thanks you for the answer, it is true that I kill the level while it's transformation tween running

     
  17. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @DanielKhoroshko By the way, remember you can kill all tweens if you want, before changing level, by calling DOTween.KillAll().
     
  18. laryk_ua

    laryk_ua

    Joined:
    Jul 26, 2014
    Posts:
    9
    Hello @Izitmee
    I've installed your latest version 1.0.716 with the latest Unity 5.0.2 and have had a lot of errors.

    First of all,
    Code (CSharp):
    1. Some scripts have compilation errors which may prevent obsolete API usages to get updated. Obsolete API updating will continue automatically after these errors get fixed.
    2.  
    And a lot of similar errors
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. DG.DOTweenEditor.DOTweenUtilityWindow.Connect (Boolean forceReconnect) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTweenEditor/DOTweenUtilityWindow.cs:240)
    3. DG.DOTweenEditor.DOTweenUtilityWindow.OnGUI () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTweenEditor/DOTweenUtilityWindow.cs:107)
    4. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    5. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    6. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    7. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    8. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:244)
    9. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:237)
    10. UnityEditor.HostView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:129)
    when I try to access the DOTween Utility Panel.
    This panel is displayed, but it is empty totally.

    Am I missing something?
    Thanx!
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @laryk_ua Hi! I'm on Unity 5.0.1, where there is no issue, but I'm downloading 5.0.2 right now so I can test it. In the meantime, could you check that you don't have a duplicate copy of DOTween in your project?
     
  20. laryk_ua

    laryk_ua

    Joined:
    Jul 26, 2014
    Posts:
    9
    @Izitmee
    Thank you for your answer!
    I've removed "DOTween" folder completely from "Assets" one and un-packed the latest version of DOTween.
    I think there is a single copy of DOTween in my project.
     
  21. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Don't know if this is a bug-report or a Feature-Request :D

    When attaching DOTween Animations to a Prefab and editing the values of the animations I have to hit the "Apply"-Button. If I don't the edited values won't be saved leading into playing animations with "old" values.
    Don't know if this is just the "Unity-Way", but if you could change this on your end, Daniele, it would be great. A little bit annoying when one just want to test something quick. Forgetting all the time to apply the changes...
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @laryk_ua Ok, should be able to test this in one hour or so (Unity download is loooong).

    @BTStone Ouch, this sounds definitely like a bug. I'm gonna investigate, though I do regular serialization with DOTweenAnimation and nothing special, so I hope it's not some new Unity bug instead.
     
  23. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @laryk_ua I tested on Unity 5.0.2 and apparently the Unity guys have gone crazy, and have changed some API from 5.0.1 to 5.0.2 without even reporting it, so it will take me a while to understand what they actually changed *_* Grumble. Working on it right now.
     
    BTStone likes this.
  24. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW DOTWEEN UPDATE 1.0.720
    • Fix for Unity 5.0.2
    IMPORTANT: upgrade to this version in order to avoid having Unity 5.0.2 updating DOTween automatically because of some discontinued code. Note that it doesn't break compatibility with older Unity version.


    @laryk_ua This fixes it :)
     
    laryk_ua likes this.
  25. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    For DOTween Pro users
    Unity 5.0.2 breaks DOTween Pro. Please wait a couple hours while I update that too
     
  26. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey Daniele, how would I add an OnComplete-Callback to a DOTweenAnimation?

    For now I have this:
    Code (CSharp):
    1.   DOTweenAnimation anim;
    2.                 anim = heartSprite.GetComponent<DOTweenAnimation>();
    3.                 anim.DOPlayById("Scale");
    4.  
     
  27. laryk_ua

    laryk_ua

    Joined:
    Jul 26, 2014
    Posts:
    9
    @Izitmee
    Seems like 1.0.720 fixed the problem.
    Thanx so much for this rapid fix!
     
  28. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW DOTWEEN PRO UPDATE 0.9.270
    • NEW: DOTweenAnimation > Added activation checkbox next to the animation selection popup, which allows to deactivate an animation
    • NEW: DOTweenAnimation > Added Camera animations and reorganized animation popup
    • BUGFIX: Fixed prefab instances not saving changes correctly unless Apply was pressed
    • BUGFIX: Fixed compatibility issues with Unity 5.0.2

    @BTStone Voilà :)
     
    BTStone likes this.
  29. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @BTStone Like this:
    Code (csharp):
    1. anim.GetTweens()[0].OnComplete(MyCallback);
    GetTweens returns all the tweens created by all DOTweenAnimations attached to a given gameObject, based on the Inspector's top-down order.
     
    BTStone likes this.
  30. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Both the new Update and the solution to the Callback works great! :D
     
  31. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Hi Izitwee, since you've done some shortcuts for textmesh pro, do you think it is possible to add some more for simple text animations? Such as what we can see in this video
    ?
     
  32. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    While we're at it: Shortcuts for NGUI?
     
  33. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    131
    Hey guys,
    I just installed DoTween Pro in Unity 5.0.1 and I have this error, when I add a DoTweenAnimation on a TextMeshProUGUI object and try to animate Text:

    ArgumentException: GetComponent requires that the requested component 'Text' derives from MonoBehaviour or Component or is an interface.
    UnityEngine.Component.GetComponent (System.Type type)
    DG.DOTweenEditor.DOTweenAnimationInspector.Validate () (at Assets/Demigiant/DOTweenPro/Editor/DOTweenAnimationInspector.cs:256)
    DG.DOTweenEditor.DOTweenAnimationInspector.OnInspectorGUI () (at Assets/Demigiant/DOTweenPro/Editor/DOTweenAnimationInspector.cs:94)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1150)
    UnityEditor.DockArea:OnGUI()

    Any idea why? Something to do with this:

    Code (CSharp):
    1.         bool Validate()
    2.         {
    3.  
    4.             // First check for regular stuff
    5.             if (AnimationTypeToComponent.ContainsKey(_src.animationType)) {
    6.                 foreach (Type t in AnimationTypeToComponent[_src.animationType]) {
    7.                     if (_src.GetComponent(t) != null) return true;
    8.                 }
    9.             }

    EDIT

    Moving the order of the "TEXTMESHPRO" section at the top, fixes the probem.
     
    Last edited: May 15, 2015
  34. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @dimitroff Ouch! Gonna investigate that, and your solution, immediately.

    @funshark I actually have plans to add those, but it might take a while because I'm prioritizing other things right now. I just pushed it a little upper in my todo list though.

    @BTStone I don't have NGUI and never used it, so I wouldn't know where to start. But if you're willing to help, you could send me a CS file where you take some NGUI properties and tween them with the generic way, and I'll make that into reusable shortcuts, then send it back to your for test ;)
     
  35. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @dimitroff Fixed it! I actually didn't have your issue, since you must be using the old Asset Store version, but I found another related issue and moving the conditional as you did fixed it.

    Grab the latest version here (the Asset Store always lags behind, because Unity takes a long time to upload, so I push it only on major milestones).

    If you're not registered to the private download forum just follow these instructions to activate it.
     
  36. Saxi

    Saxi

    Joined:
    Jun 28, 2013
    Posts:
    381
    Do you have an example scene of all the easings somewhere?
    Would be handy to have a reference in a web player or something we could easily reference.
     
  37. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Saxi Since easings are standardized, I always like to link to easings.net.
     
    Devil_Inside likes this.
  38. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @funshark @Saxi Since you linked to Zeh Fernando's fantastic work (I was a caurina fan when doing AS3 stuff—and by the way, he's on Unity too now), here's another then :)

    EDIT: ohhh it's not directly linkable :/
     
  40. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    131
    @Izitmee Thanks for this fix! another bug I found is that the Pro Examples does not work, they have missing DOTweenPath references in the OnComplete actions.
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @dimitroff That is weird. I re-checked them right now and they have no missing references here. What version of DOTween Pro are you using (you can see it in the main menu, Tools > DOTween Utility Panel)?
     
  42. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    131
    @Izitmee 0.9.280, that's weird importing it in another project, it works fine, probably something to do with my current project..
     
  43. Pinsukka

    Pinsukka

    Joined:
    Feb 17, 2014
    Posts:
    15
    Hi Izitmee! I bought DOTween Pro just a moment ago, but I'm a little lost. I've previously used iTween for paths, I had a system that worked pretty well but because of some limitations and performance issues I wanted to switch to another tween engine.

    I have a game where enemies have multiple different paths they can take. The path is chosen randomly from premade paths before the enemies are set active. Previously I was able to make paths visually with iTween path plugin, have all the paths as childs under one gameobject and I could then reference these paths simply by their name from my enemy behavior script.

    I bought the DOTween Pro so I could use visual path editor with DOTween, but once I bought it I noticed the way things work with your tween engine are quite different. It seems I cannot have multiple paths for my enemies like I previously had.

    Is there a way to make paths with visual path editor and still reference them somehow from script? Or am I limited to having one path per gameobject if I want to create my paths visually?

    Also another question, how do I set paths by scripting in the first place? I have looked at the documentation but I cannot get things to work for some reason. Right now I'm getting error saying "DOPath does not exist in the current context" or something, I was assuming I needed to add "using DG.Tweening;" at the beginning of my script, but DOPath does still not exist.

    I feel like an idiot, hope you can help, haha. :D
     
  44. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @Pinsukka you can make an Manager that actives different gameobjects with path randomly.
    DoPath works with the Transform. for example this.gameobject.transform.DoPath etc...
     
  45. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Pinsukka What @meapps said :) Also, I'm gonna see if I can implement an easier way for your use case. A collection of paths, mhmm, never thought about it.
     
  46. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Is there a RectTransform.DoAnchorPos for the Unity 5 version of DoTween? I'm not seeing it. If not, what is recommened for sliding in an Panel?
     
  47. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    Just wanted to say an excellent asset and one of the few I have found that you have fun working with (which in my book counts as an outstanding plugin). I had a similar question as @jeffweber. I also wanted to know if it is possible to apply the tween to parents/children together (so for example if I want a panel with a bunch of objects within it to fade, how would I go about doing that using code)? Do I need to attach the tween animation component to all objects and then play the animation when needed? I am sure there is a smart way of doing it :).

    Thanks,
    Sam
     
  48. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    @iamsam list or array and an for loop for the fading several objects. You could use an gameobjects list etc. or make an Effect Manager.
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @jeffweber There totally is. Did you run DOTween's Setup (from Tools > DOTween Utility Panel)? That is needed to determine your version of Unity correctly and activate shortcuts for newer versions.

    @iamsam Great review, thanks! :) About RectTransform, check what I said above. About fading multiple objects you can do like @meapps said (and maybe even put them all in a Sequence for convenience) or, if you're talking about UGUI panels, just create a single CanvasGroup DOFade tween, which will fade the canvas and all children.
     
  50. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @Izitmee, I only imported the Unity 5 dlls. I did see the docs you linked too, but for the section on RectTransform, it says "RectTansform (Unity 4.6)" and Intellisense does not show the DoAnchorPos method for me in Unity 5.

    Form docs you linked to (minus formatting of course):
    RectTransform (Unity UI 4.6)
    Expand all
    DOAnchorPos(Vector2 to, float duration, bool snapping)
    DOAnchorPos3D(Vector3 to, float duration, bool snapping)
    DOPunchAnchorPos(Vector2 punch, float duration, int vibrato, float elasticity, boolsnapping)
    DOShakeAnchorPos(float duration, float/Vector3 strength, int vibrato, float randomness, boolsnapping)
    DOSizeDelta(Vector2 to, float duration, bool snapping)

    -Jeff