Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    127
    I Got message:"DOTWEEN :: Null Tween" when call this.tweenPath.GetTween().ForceInit();Why NULL Tween?
     
  2. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @sathya With myDOTweenPath I meant a reference to your DOTweenPath, not a static method. Like this for example:
    Code (csharp):
    1. DOTweenPath myDOTweenPath = this.GetComponent<DOTweenPath>();
    2. Tween t = myDOTweenPath.GetTween();
    @tinyant A tween is an animation object that is created only at runtime, so I'm afraid you can't access it while in the editor. But I'll ponder about this.
    About editing waypoint at runtime, that is not possible either because when a tween starts the path becomes fixed, and also DOTweenPath in generals are not made for runtime editing.
     
  3. ikarjon

    ikarjon

    Joined:
    Mar 31, 2013
    Posts:
    8
    Hi,

    I have tested the latest version of DOTween with Unity 5.4 (beta) and although everything works inside Unity editor I can't compile the code for Android APK.
    Have you done any testing with Unity 5.4? Or is it something I'm doing wrong?
     
  4. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    127

    @Izitmee

    I find a "special" way may be right way to get the DOTweenPath data in the Editor mode.
    I make DOTween "DG.Tweening.Core.Debugger.logPriority=3;" so that I can see DOTween's Log when call ForceInit(). In the console outputs:"DOTWEEN :: Null Tween", I wonder that DOTweenPath's Tween will be Init() at the Awake() function. but In the Editor Unity3D can't can call Awake() So I use Reflection to call DOTweenPath script's Awake() manually. After call the Awake() function just make ForceInit(). I can get the tween's informations I wanted.Like get the path points by given percentage.

    Here is my code,By doing this I can make a slider to control the target path percentage to put my camera on the right position.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DG.Tweening;
    4.  
    5. #if UNITY_EDITOR
    6. [ExecuteInEditMode]
    7. #endif
    8. public class CoolTweenEditor : MonoBehaviour
    9. {
    10.     // DOTween path.
    11.     public DOTweenPath tweenPath;
    12.  
    13.     public Transform tweenTarget;
    14.     public Transform tweenLookAtTarget;
    15.  
    16.     public bool isNeedUpdate = false;
    17.  
    18.     // set the path percentage.
    19.     [Range(0, 1)]
    20.     public float percent = 0.0f;
    21.     private double curTime = 0.0f;
    22.  
    23.     void OnEnable()
    24.     {
    25.         // SendMessage("Awake"); will get ShouldRunBehaviour() error. it must be [ExecuteInEditMode] flag.
    26.  
    27.         this.InitTweenPath();
    28.         // get the DOTween log message.
    29.         DG.Tweening.Core.Debugger.logPriority = 3;
    30.         this.tweenPath = GetComponent<DOTweenPath>();
    31.  
    32.         // call Update Function on Editor mode.
    33.         UnityEditor.EditorApplication.update += MyEditorUpdateFunction;
    34.         curTime = UnityEditor.EditorApplication.timeSinceStartup;
    35.  
    36.         // force init the DOTweenPath
    37.         this.tweenPath.GetTween().ForceInit();
    38.         bool isInit = this.tweenPath.GetTween().IsInitialized();
    39.         Debug.Log("@ DOTweenPath Init : " + isInit);
    40.     }
    41.  
    42.     void OnDisable()
    43.     {
    44.         UnityEditor.EditorApplication.update -= MyEditorUpdateFunction;
    45.     }
    46.  
    47.     private void InitTweenPath()
    48.     {
    49.         // typeof(CoolTweenEditor).GetMethod("Awake", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(this, new object[0]);
    50.         // call private DOTweenPath Awake() function to init the tween manually.
    51.         typeof(DOTweenPath).GetMethod("Awake", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(this.tweenPath, new object[0]);
    52.     }
    53.  
    54.     void MyEditorUpdateFunction()
    55.     {
    56.         this.Update();
    57.     }
    58.  
    59.     private void Update()
    60.     {
    61.         if (!isNeedUpdate)
    62.             return;
    63.  
    64.         // if (UnityEditor.EditorApplication.timeSinceStartup - this.curTime >= 4.0f)
    65.         {
    66.             if (this.tweenPath != null)
    67.             {
    68.                 // get right position of the path and put target on the path.
    69.                 Vector3 pos = this.tweenPath.GetTween().PathGetPoint(percent);
    70.                 tweenTarget.position = pos;
    71.                 tweenTarget.LookAt(this.tweenLookAtTarget);
    72.             }
    73.         }
    74.     }
    75. }
    76.  
    I wish this can help others.
     

    Attached Files:

    Demigiant likes this.
  5. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Im getting issues in 5.3.4. Cant load the utility window, just get a white small box in its place and have to force quit Unity?
     
  6. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Hi @Izitmee

    When enabling "recycle tweens" I sometimes get a situation where a tween/sequence will not play if I start multiple tweens simultaneously. Is there a way to safeguard against this, or should I disable recycling?

    @mimminito - The utility window works fine for me in 5.3.4.
     
  7. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Sorry for multiple posts, but I'm now wondering if I am using sequences incorrectly in my code. Is it ok to do something like this:

    Code (CSharp):
    1.  
    2.         Sequence animateIn;
    3.         Sequence animateOut;
    4.  
    5.         public void AnimateIn()
    6.         {
    7.             animateIn.Kill();
    8.             animateOut.Kill();
    9.  
    10.             animateIn = DOTween.Sequence();
    11.             animateIn.Insert(0.1f,myMaterial.DOColor(Color.white,0.7f));
    12.             animateIn.Insert(0f,myRectTransform.DOScale(1,1f));
    13.             animateIn.Insert(0f,myImage.DOColor(Color.white,0.3f));
    14.  
    15.             animateIn.Play();
    16.         }
    17.  
    18.         public void AnimateOut()
    19.         {
    20.             animateIn.Kill();
    21.             animateOut.Kill();
    22.  
    23.             animateOut = DOTween.Sequence();
    24.             animateOut.Insert(0f,myMaterial.DOColor(Color.clear,0.5f));
    25.             animateOut.Insert(0.1f,myRectTransform.DOScale(0,0.4f));
    26.             animateOut.Insert(0f,myImage.DOColor(Color.clear,0.2f));
    27.  
    28.             animateOut.Play();
    29.         }
    What I'm trying to do is set up sequences that can be interrupted and continue from where they left off. Is this the right way to achieve this? Is it ok to kill a sequence and then reinitialise it? Is it ok to call Kill() on a sequence that possibly hasn't started/ isn't currently running?

    Thanks!
     
  8. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Hmm, im on OSX if that makes a difference. Ill try again now.

    EDIT: Working today, must have been a bad import yesterday (even though I tried 3 times...)
     
  9. mikatu

    mikatu

    Joined:
    Aug 3, 2015
    Posts:
    28
    @flashframe Recycling means that any unused (= killed) tweens can be reused by DOTween. When you are calling Kill() in your code, it is possible that the tween has already completed and is referring to another tween in your system. This can be avoided by setting them null after completion, like this

    Code (CSharp):
    1.  
    2.         Sequence animateIn;
    3.         Sequence animateOut;
    4.  
    5.         public void AnimateIn()
    6.         {
    7.             if (animateIn != null)
    8.                         animateIn.Kill();
    9.             if (animateOut != null)
    10.                         animateOut.Kill();
    11.  
    12.             animateIn = DOTween.Sequence();
    13.             animateIn.Insert(0.1f,myMaterial.DOColor(Color.white,0.7f));
    14.             animateIn.Insert(0f,myRectTransform.DOScale(1,1f));
    15.             animateIn.Insert(0f,myImage.DOColor(Color.white,0.3f));
    16.             animateIn.OnKill(() => animateIn = null);
    17.  
    18.             animateIn.Play();
    19.         }
    20.  
    Edit: Checked the docs and, actually OnKill is safer for this purpose.
     
    Last edited: Mar 18, 2016
    flashframe and Demigiant like this.
  10. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW UPDATE v1.1.200
    • NEW: DOTween Inspector > Added Play/Pause All buttons
    • NEW: Added ScrollRect.DOHorizontal/VerticalNormalizedPos + DONormalizedPosshortcuts
    • NEW: Added RectTransform.DoAnchorMin/Max shortcuts
    • BUGFIX: Compatibility fix for Unity 5.4
    • BUGFIX: Unity UI fix for Hyper-compatible version
    • BUGFIX: Fixed OnPlay being called before eventual delays are complete (only after first run)
    • BUGFIX: Fixed OnWaypointChange being called only once even if the tween went through multiple waypoints since the last update
    • BUGFIX: Fixed Flash ease not being fluid when moving slowly
    • BUGFIX: Fixed OnComplete not being called for last nested tween in case of very short Sequences

    P.S. answers coming in a few minutes in the next post
     
  11. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @mimminito No issues here either. Glad you solved it :)

    @flashframe You might have encountered an issue on which I'm working right now. Will post an update as soon as it's done. On a secondary note, I actually do suggest to disable recycling. DOTween already recycles its most expensive parts (plugins) even when recycling is off. Also, I read what @mikatu wrote after answering this, and he's totally right (thanks!).

    About interrupting Sequences, you could actually create a single one and use Play/Pause methods on it. Also, as long as you also set autoKill to false (so the Sequence is not destroyed when complete) you can also reuse it and play it backwards (with PlayBackwards - just remember that when you'll want to play it forwards again you'll have to use PlayForward and not just Play) for an auto-animate-out animation (I do that all the time, and recommend it).

    @tinyant Thanks a lot for the code. That looks very interesting :)

    @ikarjon Try the new DOTween version I posted above. Unity 5.4 is a buggy mess, and maybe what was just a warning in the editor becomes an error on Android.
     
    flashframe and meapps like this.
  12. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @mikatu @Izitmee

    Thank you both for your help, really appreciate it! Makes sense to null the sequence once it's finished playing, and to check it exists before trying to Kill it. Also good to know that I can disable recycling without much of a performance impact.

    Definitely going to see which of my animations are suited to sharing a sequence that plays forwards/backwards. That would certainly simplify the code.

    Thanks again!
     
    Last edited: Mar 18, 2016
  13. ikarjon

    ikarjon

    Joined:
    Mar 31, 2013
    Posts:
    8
    Hi,

    Tested the latest version and got same error :

    Code (CSharp):
    1. Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    2.   at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    3.   at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
    4.   at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
    5.   at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
    6.   at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
    7.   at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
    8.   at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
    9.   at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
    10.  
    11. The following assembly referenced from \DOTween\DOTween46.dll could not be loaded:
    12.      Assembly:   UnityEngine.UI    (assemblyref_index=4)
    13.      Version:    1.0.0.0
    14.      Public Key: (none)
    15. The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (Assets\Scripts\DOTween\).
    Inside Unity ditor everything works perfectly. This only happens when I compile to Android (APK).
    It's also possible that the problem resides in Unity 5.4 (beta). Let's hope everything works when they release the final version.

    Thank you for your great work.
     
  14. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @ikarjon Ah, now that I see the error I recognize it. Unity forgot to use a common signature for their UI library, and thus DOTween can't recognize it. They did the same mistake a few more times in the past, but always in betas if I remember correctly and then fixed it. Still, they could pay a little more attention :(
     
  15. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Fantastic stuff @Izitmee !

    Could you share some examples on how to use the DoAnchorMax ? Please :)
    Particularly, could you maybe give me a hint as to how set the anchors to screen corners?
    I've been trying to scale an image to full screen size for 58 minutes now... Eyes getting blurry.

    I've got some magic numbers that seem to work in my application, but it is kinda random and haphazard and guess-y...

    Code (CSharp):
    1.  _buttonImage.rectTransform.DOAnchorPosX(-360, 0.5f);
    2.  _buttonImage.rectTransform.DOAnchorPosY(-300, 0.5f);
    3.  _buttonImage.rectTransform.DOAnchorMax(new Vector2(10f, 20f), 0.5f);
    Maybe I'll figure this out after I get some sleep, but if anyone would like to take a shot at it before I wake up...

    Grazie
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @FuguFirecracker Ahoy! Glad you like the new stuff, but to be honest I have no clear idea of how to use anchorMin/Max. I added those because Playmaker's Jean Fabre asked for them, but I never used them myself :B If it can help, he said this: "It's a bit messy when you first toy around with them cause you need to readjust the AnchoredPosition and the SizeDelta because Unity automatically adjust these values... but then it's very powerful cause you don't deal with pixels at all!"

    Hope someone else will chime in and shed some additional light ;)
     
  17. Mintonne

    Mintonne

    Joined:
    Aug 7, 2015
    Posts:
    306
    This is an amazing tool. Why didn't I know about it much earlier. :(:(

    Anyway, I am trying to implement a simple translation to my rigid body. I am using unity's translate to move it forward then using DOTtween to move it left and right.
    Everything is working fine except that when I am moving left or right the forward translation is paused.
    Ps: read through this thread until around page 25 looking for a solution but didn't find anything.
    Someone please help. :)
     
  18. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Solved, in that I can use updateTween.


    Hi Daniele,
    If I set a path, lets say it moves from (1,1,1), to (-1,-1,-1). is there anyway to know when the transform crosses the y plane, @ y = 0 before I run the tween? If so, its because I want to know what the transforms position will be at that point.


    Thanks!
     
    Last edited: Mar 22, 2016
  19. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Thanks, this was my solution. Is there a way to set the duration for playing backwards?
     
  20. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    This is due the tween and forward translation are "fighting" each other over the current transform. You have to see translations as teleportation and not movement. But since you are using a Rigidbody, you can use the physics system for real movement, i.e. using force to push it sideways.

    Unity provides plenty of tutorials on this topic :)
     
    Demigiant and Mintonne like this.
  21. Mintonne

    Mintonne

    Joined:
    Aug 7, 2015
    Posts:
    306
    well, that's a bummer. Tried a lot ot stuff but nothing has a smooth transition. It is just abrupt.
    Thank you anyway.
    Kindly PM me if you have any idea of how i can achieve a smooth sideways translation while still moving forward
     
  22. reggie3

    reggie3

    Joined:
    Oct 8, 2014
    Posts:
    1
    I have multiple identical GameObjects performing the tween below:

    Sequence blockTweenSequence = DOTween.Sequence().SetDelay(killDelay);
    blockTweenSequence.Append(transform.DOMoveZ(transform.position.z - 3, deathTweenDuration/2));
    blockTweenSequence.Append(transform.DOMoveX(3, deathTweenDuration/2));
    blockTweenSequence.Insert(1, transform.DOMoveY(25, deathTweenDuration/2)).OnComplete(setDead);
    blockTweenSequence.Play();

    killDelay ranges from 0 to 1 second.
    Only the first object performs the first portion of the tween; the DOMoveZ. I swapped the DOMoveX to the first item in the sequence, and still, only the first object that move actually did the x translation.

    I am using the default DOTween init.

    Any idea why only the first portion of the tween is done by only the first object to move?
     
  23. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    "Bit messy" is an understatement. Days I faffed-about trying to coax predictable results from tweening anchors.

    It did not go well.

    Let's never speak of it again.
     
  24. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    187
    I'm fairly new(picked up the pro version yesterday) to DOTween, I guess I'm just missing the obvious here, but how should I supposed to stop a certain tween? Is there a PauseByID() somewhere? (I found the static function, but that wont help this case as I only want to stop a tween on certain object(s)). Sorry if this was discussed already, 44 pages are a bit overwhelming. :)
     
  25. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    If you cache the Tween to a variable you can call Pause() on it like this:

    Code (CSharp):
    1. Tween myTween = myObject.DOMove...//etc
    2. myTween.Pause();
    If you want to use any of the controller methods on a tween that's ended, you have to make sure to set AutoKill to false.

    Sequences are very useful too, if you are tweening a group of values.
     
    Last edited: Mar 26, 2016
    Demigiant likes this.
  26. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    187
    @flashframe Sorry, I should have mentioned I'm creating everything in the editor, ideally I would like to manage this stuff from there as well(thanks for the snippet tho, I made a small extension for the DOTweenAnimation class based on that, but still would like to know if there is a builtin way to do this, I reinvented the wheel way too many times already).
     
  27. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @Pecek Ah, I see, sorry! Hopefully someone can help you with this :)
     
    Demigiant likes this.
  28. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    177
    Just bought this asset, and got this error after installing in Unity 5.3.2f1 :
    Assets/Demigiant/DOTweenPro/Editor/DOTweenAnimationInspector.cs(325,22): error CS0266: Cannot implicitly convert type `LoopType' to `DG.Tweening.LoopType'. An explicit conversion exists (are you missing a cast?)

    It's a game stopper, so could I have a fix plse - and why is no one else getting this? It's the version that is currently up on the asset store (according to your instructions, I can get the version number by using the 'tools' menu, but I don't have a tools menu att. Thanks.

    Cheers.
     
  29. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Do you already have a LoopType enum defined in your project somewhere that isn't wrapped in a namespace?
     
    Demigiant likes this.
  30. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @garrido86 You can't change the duration of a tween, but you can use a trick. Since you can change its timeScale at any moment, you can just find the right value and use that :)

    @Mintonne Glad you like it :) @garrido86 is absolutely right, though you could use a trick here, if you don't need "left/right oscillation" collisions. Just use a parent-child setup, use physics on the parent, and tween the child for oscillation.

    @reggie3 That is indeed very weird. The only reason that comes to my mind is that you have something else coming in play and keeping the other object's stationary for a while?

    @Pecek Hi, and thanks for getting the Pro :) To pause/play/rewind/etc a DOTweenAnimation/Path, you have DOPause/Play/Rewind/etc methods for them. Even if you have multiple DOTweenAnimation/Path on the same gameObject, if you grab a reference to one and use DOPause/Play/etc, all the DOTweenAnimations for that gameObject will react. Otherwise, you can also use DOPauseById as you mentioned.

    @wheelbarrow As @flashframe said, that means that you have another asset (or your own code) that has a LoopType member without namespace, and thus "eats" any other LoopType members on other assets. If you have it in another asset, please let me know so I can contact the author, because that's a an error on his side and only he can fix it.

    @flashframe Thanks a lot for the help! :)
     
  31. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    177
    @Izitmee Ok, found the culprit, the asset is called "Easy Waypoints - Path System" by Allebi. Ironically, that is the asset I wanted to replace with DOTween Pro in the project anyway, so it all worked out - your asset imported with no errors once I removed it from the project.
    Cheers.
     
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
  33. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
    Hey,
    I'm not new to dotween but I recently bought TextMesh pro and I'm not able to get the simple DOText() function to work with it.. coz that function is just not there..



    Any Ideas?
     
  34. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    I don't have DoTween Pro but I think you just need to Setup DoTween. For this go to Tools -> DotWeen Utility Panel -> "Setup DoTween..."



    This should enable the necessary namespaces on the DoTween Pro .dll.
     
    Demigiant likes this.
  35. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
    Oh yea!!.. That was the issue.. But just setting up dotween gave me errors.. so I reimported dotween pro and now it works fine.. Thanks!!
     
    garrido86 likes this.
  36. Ant1m3tas

    Ant1m3tas

    Joined:
    Feb 24, 2015
    Posts:
    4
    @Izitmee Hi.

    I want to know a vector that corresponds to tween 50% value.

    The PathGetPoint(float) works in editor play mode, but when trying to call it from edit mode (without hitting play button first), it wont work ((
     
  37. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Ant1m3tas Hi. PathGetPoint requires the tween to be created in order to work, and tween are only created at runtime. Why you need it in the editor? Maybe I can think of an alternative solution.
     
  38. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    92
    Heya,

    How can I use DOMove to a moving target?

    I'm trying to move an object to some place on my GUI-HUD, while the camera is climbing up.

    This what I use atm:
    Code (CSharp):
    1. this.transform.DOMove(m_TargetStars.transform.position, 1f).OnComplete(() => base.Hide());
    2. this.transform.DOScale(0f, 1f);
     
  39. Demigiant

    Demigiant

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

    If you download the examples here, they include a follow tween.

    That said, in your case I would strongly recommend to instead have a different camera for the GUI, so you just have to move your target to GUI coordinate/camera-system, and make a simple tween. Much more efficient and manageable than a constantly moving GUI :p
     
  40. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    DOTWEEN UPDATE v1.1.260
    • BUGFIX: Fixed IndexOutOfRangeException happening in rare occasions when tweens capacity had not been manually set
    • BUGFIX: Fixed error happening when calling DOTween.KillAll from inside anOnComplete callback

    And now I want to say WOHOOOO! Some of you might have encountered the IndexOutOfRangeException issue (which could be solved by simply using DOTween.SetCapacity), but I had never being able to reproduce it and it was driving me crazy. Thanks to @mikatu and @ababab5 that gave me a way to finally reproduce it (thanks a lot guys, really), it's now officially out of the way.

    It took me a while, because I was sure the error was happening inside the super-complicated(ish) organization routines I use in DOTween. Instead, as it often happens with bugs, I was looking in the wrong place and the solution was incredibly simple. Whew.
     
    ababab5 and GoGoGadget like this.
  41. Ant1m3tas

    Ant1m3tas

    Joined:
    Feb 24, 2015
    Posts:
    4
    I'm using dotween for enemy movement in shmup. Goal is to create dots on tween that will tell the enemy to fire up some events upon reaching them.

    I've made it work in runtime, as you said. But was wondering if it was possible to do same thing in editor mode?
     
  42. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Always a pleasure...
     
  43. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    How can I upgrade to that safely with PRO or is it also coming soon?
     
  44. moh05

    moh05

    Joined:
    Nov 26, 2015
    Posts:
    65
    Hello guys,

    I am creating a card game similar to monopoly deal. The cards are UI Images.

    Cards can move from hand to the ten white slots present on table, or back to the deck in the middle.

    I was using another tween engine to move cards but the card movement seems like lagging or slow.

    View attachment 180486
    I want to try Dotween but wanted to be sure cards won't move slowly too as changes will take time

    Is there any specific way to move UI elements to a given Transform/RectTransform or any Vector3 point in an efficient way ? Or Is it because Im using a world canvas ?

    Thanks for your help :)
     
  45. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    @Izitmee
    Hi there, I have a bit of a struggle when I use a delayed Tween like this :
    Code (CSharp):
    1. transform.DOScaleY(0.2f, 1f).From().SetDelay(1f);
    It instantly set the scale to 0.2f, wait 1f second, then tween it. Instead, would it possible to set the scale to 0.2f only when it actually starts? (so the scale remains the same during the delay)
    Thanks!
     
  46. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    @SoulGameStudio The way you want to make it work is just not how the whole system works (because we want something to be set right away to the initial value), instead what you could do is set a manual timer (for your delay) and then once that completes create the tween.

    Code (CSharp):
    1.  
    2. float timer = 0.0f;
    3. float duration = 5.0f;
    4. DOTween.To(() => timer, x => timer = x, 1.0f, duration).OnComplete(() =>
    5. {
    6.         //Your tween here
    7. });
    8.  
    Hope this helps!
     
    Demigiant and SoulGameStudio like this.
  47. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    Thanks, this is indeed a solution to my issue :) Still I wonder why the system would be so rigid regarding that point. I mean maybe we could chain a SetValueOnStart(true) or such..?

    Anyway, I'll go with your solution, thanks for the swift reply!

    EDIT: based on what you suggested, I found that which seems quite convenient, just in case:
    Code (CSharp):
    1. DOVirtual.DelayedCall(2f, () => {
    2.        // Delayed Tween
    3. });
     
    Last edited: Apr 4, 2016
    JakeTBear likes this.
  48. D3ntrax

    D3ntrax

    Joined:
    Mar 21, 2014
    Posts:
    35
    @Izitmee
    @JakeTBear


    Hello, I want to make a simple vortex (circual) effect with HOTween. I created a little and simple animation on my Edge Animation CC. How can I make this animation on Unity with HOTween ? (The simple animation object must have a circle point for smooth and realistic move.)

     
  49. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    two questions/feature requests...

    1: is it possible to add more than one completion callback. Seems that if I call OnComplete more than once the most recent one will overwrite the others. This would be nice to be able to do

    2: could you expose Tween.autokill to be readable? My use case may be uncommon but I'd like to be able to detect if a tween is set to autokill or not.

    Thanks!
     
  50. thatnzguy

    thatnzguy

    Joined:
    Jun 8, 2015
    Posts:
    20
    Does DoTween support multiple callbacks OnComplete? The DoTween Playmaker actions have a problem where one callback is set, and then another is set which appears to overwrite the previous one.

    Also, the asset store version is old, it's 1.1.135 currently.

    Edit: Oh, The post above suggests only one callback is supported!
     
    Last edited: Apr 8, 2016