Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    35
    Hey peeps,

    Does anyone know if DOTween uses late update or standard update?

    Im hoping to use it with some animation, and I dont really want the faff of making avatar masks for animation clips so animations can be 'overriden' as it were.

    I just want what I do in LateUpdate to change the animation by adding on extra DOTween rotations.

    Any help would be gratefully recieved,

    thanks.
     
  2. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    You can mix and match between all update types.

    SetUpdate()

    http://dotween.demigiant.com/documentation.php#options
     
  3. aidinz

    aidinz

    Joined:
    Apr 17, 2016
    Posts:
    62
    Hi,

    I'm trying to tween a Text object residing inside a world space canvas but the problem is somehow for the life of me the Text object FOLLOWS the sequence of tweens I give to the Text object!

    The Text object appears on top of the player, gets big and moves up and fades out BUT if player is falling, the direction of DoMoveY is apprently affected!

    Also tried TextMesh Pro, I thought problem is the world canvas of regular Text object but that's not the case. I don't know why I cannot debug and see your code and how it runs, maybe it's a DLL?

    Here is my code:

    Code (CSharp):
    1.  
    2.             ScoreOnPlayerText.gameObject.SetActive(true);
    3.  
    4.             Vector3 playerPos = PlayerController.Instance.gameObject.transform.position;
    5.  
    6.             ScoreOnPlayerText.transform.position = new Vector3(playerPos.x, playerPos.y + 1.5f, playerPos.z);
    7.             ScoreOnPlayerText.text = amount + "X COMBO!!!";
    8.             ScoreOnPlayerText.transform.localScale = Vector3.zero;
    9.  
    10.  
    11.  
    12.             Sequence scoreOnPlayerTextTweenSequence = DOTween.Sequence();
    13.             scoreOnPlayerTextTweenSequence.Append(ScoreOnPlayerText.transform.DOScale(1.5f, 0.25f));
    14.             scoreOnPlayerTextTweenSequence.Append(ScoreOnPlayerText.transform.DOScale(1, 0.25f));
    15.             scoreOnPlayerTextTweenSequence.Append(ScoreOnPlayerText.transform.DOMoveY(2, 0.5f));
    16.             scoreOnPlayerTextTweenSequence.Join(ScoreOnPlayerText.DOFade(0, 0.5f));
    17.  
    18.  
    19.  
    20.             // Reset the faded out material by tweening.
    21.             ScoreOnPlayerText.color = new Color(
    22.                 ScoreOnPlayerText.material.color.r,
    23.                 ScoreOnPlayerText.material.color.g,
    24.                 ScoreOnPlayerText.material.color.b, 1);
     
  4. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    407
    I'm having a difficult time understanding what this actually means.
    Diagram or GIF or one act play would go a long way toward illustrating the conundrum.

    Shot in the dark => Have you tried DoLocalMove ?
     
  5. aidinz

    aidinz

    Joined:
    Apr 17, 2016
    Posts:
    62
    I've trield DoLocalMove, same thing. And my target is not a child of another GO.

    What I meant is when player moves, if affects the direction of DoMoveY! If player is standing still, it works perfectly but if player is falling then DoMoveY goes down instead of up.
     
  6. robertono

    robertono

    Joined:
    Jun 3, 2014
    Posts:
    23
    Hello guys!
    Love this package and using it for a long time already. Have a question and really need help!

    How can I do some action after some specific progress of my tween?
    For example, if I have transform.DOTween(myPosition, 1f), how could I get some one-time (or whatever) callback after for example 70% of my tween has been completed? No, I don't want to just wait for 0.7 seconds somewhere else, because what if I'll set it to be a speed-based, or whatever.
    Can it be done at all? If yes then how?

    Thank you very much!
     
  7. alexxUID

    alexxUID

    Joined:
    Jan 14, 2020
    Posts:
    21
    I have a very noobish question:

    If I create a tween and store the reference to it, shouldn`t the reference be null again as soon as the tweening animation has ended?
    (given setAutoKill is true, which it is by default)

    Code (CSharp):
    1.     Tweener myTween = default;
    2.  
    3.     void Update()
    4.     {
    5.         Debug.Log("Tween: " + myTween);
    6.         if (Input.GetKeyDown(KeyCode.D))
    7.         {
    8.             TweenMove();
    9.         }
    10.     }
    11.  
    12.     private void TweenMove()
    13.     {
    14.         Vector3 newLocation = new Vector3(Random.Range(-10, 10), 5, Random.Range(-10, 10));
    15.         myTween = transform.DOMove(newLocation, 2f).SetAutoKill(true);
    16.     }
    In my example I only get an empty debug until the D key is pressed the forst time. After that the tween reference is kept forever.
     
  8. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    Do you have "recycleAllByDefault" enabled in the DOTween settings panel?
     
  9. alexxUID

    alexxUID

    Joined:
    Jan 14, 2020
    Posts:
    21
    Thanks.
    Good idea but no. Neither that nor did I use DOTween.Init(..) somewhere.

    But my thinking is correct? When a Tween has ended it is automatically killed and the reference should be null?

    Using .SetAutoKill() does not change anything for me being true or false.
     
  10. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    I'm not sure about that actually - I realise I usually manually set the tween reference to null in the OnKill() callback if I want to be sure it's null (perhaps because I ran into this issue in the past?!)

    OnKill(()=> myTween = null)
     
    alexxUID likes this.
  11. Debashishb06

    Debashishb06

    Joined:
    Feb 7, 2013
    Posts:
    8
    when i am import this package on my unity 2019.4.3f1 i got given below error.


    PrecompiledAssemblyException: Multiple precompiled assemblies with the same name DOTween.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths:
    Assets/JMRSDK/Core/Plugins/DOTween/DOTween.dll
    Assets/Plugins/Demigiant/DOTween/DOTween.dll
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ValidateAndGetNameToPrecompiledAssembly (UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssemblies) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ToScriptAssemblies (System.Collections.Generic.IDictionary`2[TKey,TValue] targetAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+CompilationAssemblies assemblies, System.Collections.Generic.HashSet`1[T] runUpdaterAssemblies) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.GenerateChangedScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+GenerateChangedScriptAssembliesArgs args) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly[]& notCompiledTargetAssemblies, System.String[]& notCompiledScripts) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.TickCompilationPipeline (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.TickCompilationPipeline (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)


    PrecompiledAssemblyException: Multiple precompiled assemblies with the same name DOTween.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths:
    Assets/JMRSDK/Core/Plugins/DOTween/DOTween.dll
    Assets/Plugins/Demigiant/DOTween/DOTween.dll
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ValidateAndGetNameToPrecompiledAssembly (UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssemblies) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ToScriptAssemblies (System.Collections.Generic.IDictionary`2[TKey,TValue] targetAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+CompilationAssemblies assemblies, System.Collections.Generic.HashSet`1[T] runUpdaterAssemblies) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.GetAllScriptAssemblies (System.Collections.Generic.Dictionary`2[TKey,TValue] allSourceFiles, System.String projectDirectory, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+CompilationAssemblies assemblies, System.Collections.Generic.HashSet`1[T] runUpdaterAssemblies, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssemblyType onlyIncludeType) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] unityAssembliesArg, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssembliesArg, System.String[] defines) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, System.String[] defines) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Compilation.CompilationPipeline.GetEditorAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorCompilation editorCompilation, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions additionalOptions, System.String[] defines) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorCompilation editorCompilation, UnityEditor.Compilation.AssembliesType assembliesType) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Compilation.AssembliesType assembliesType) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.Compilation.CompilationPipeline.GetAssemblies () (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.VisualStudioIntegration.AssemblyNameProvider.GetAssemblies (System.Func`2[T,TResult] shouldFileBePartOfSolution) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.GenerateAndWriteSolutionAndProjects (UnityEditorInternal.ScriptEditorUtility+ScriptEditor scriptEditor) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.SyncIfNeeded (System.Collections.Generic.IEnumerable`1[T] affectedFiles, System.Collections.Generic.IEnumerable`1[T] reimportedFiles) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.SyncVS.PostprocessSyncProject (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at <bccb16a88ec4456dbf07978c418f407b>:0)
     
  12. Mike01923

    Mike01923

    Joined:
    Jun 19, 2015
    Posts:
    166
    When I animate UI buttons, they don't animate smoothly. Example is when I'm trying to animate the scale of a modal container. The buttons are parented to a gameobject with a content size fitter & vertical layout group. I tried removing both components and the issue still persists.



    Code (CSharp):
    1. mySequence = DOTween.Sequence();
    2.         mySequence.SetUpdate(true);
    3.      
    4.         mySequence.Insert(0f, modal.DOScale(modalScale, modalScaleDuration)
    5.             .SetEase(Ease.OutElastic)
    6.             .From());
    7.         mySequence.Insert(0f, blackout.DOFade(blackoutFade, blackoutFadeDuration)
    8.             .SetEase(Ease.OutQuad)
    9.             .From());
    10.      
    11.         mySequence.Play();
     
  13. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    54
    Hi all
    I have an enum on a property panel in the editor to allow me to easily select the Dotween Ease for my objects.

    In my scripts I then have a switch/case statement that goes through each of my enums entries and sets it to the appropriate dotween ease entry. It works, but makes for a lot of code, particularly if you add one for the setease, one of the Flash ease etc etc.

    Anyone had to do this with a custom enum and had to translate it to set the dotween enum? Any pointers?

    I have something like this:

    Code (CSharp):
    1.         private enum ButtonPanelAnimations
    2.         {
    3.             easeInSine,
    4.             easeOutSine,
    5.             easeInOutSine,
    6.             easeInQuad,
    7.             easeOutQuad,
    8.             easeInOutQuad,
    9.             easeInCubic,
    10.             easeOutCubic,
    11.             etc}
    12.  
    Then something like this in my function:

    Code (CSharp):
    1.             switch (ButtonPanelAnimation)
    2.             {
    3.                 case ButtonPanelAnimations.easeInSine:
    4.                     {
    5.                         tempTween.SetEase(Ease.InSine);
    6.                         break;
    7.                     }
    8.  
    9.                 case ButtonPanelAnimations.easeOutSine:
    10.                     {
    11.                         tempTween.SetEase(Ease.OutSine);
    12.                         break;
    13.                     }
    etc

    But there are ALOT of eases and the code ends up being massive. Wonder if there is a more efficient way.

    Olly
     
    Last edited: Oct 19, 2021
  14. B2F

    B2F

    Joined:
    Jul 10, 2013
    Posts:
    21
    I'm constantly getting the 'New Version of DOTween Imported' popup, but when I press the 'Open DOTween Utility Panel' button it just popups up a window that says 'Completing import process' and it stays there forever. Any idea how I can fix this? Unity version 2020.1.15f1. DOTween version 1.2.632.
     
  15. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    407
    Why are you re-enumerating the Enum?
    You do not need to do this.

    Do This :
    Code (CSharp):
    1.  
    2. private Ease _ease;
    3.  
    4. private void WhyAmIEvenUsingASwitchHere(Ease ease)
    5.         {
    6.             switch (ease)
    7.             {
    8.                 case Ease.Unset:
    9.                     break;
    10.                 case Ease.Linear:
    11.                     break;
    12.                  //   case  ALL THE EASE ...
    13.                 // Your IDE will populate this automatically with every Ease case
    14.             }
    15.         }
    BUT YOU DO NOT NEED A SWITCH !!!
    Code (CSharp):
    1.      private void TakeItEasy(Ease ease)
    2.         {
    3.             _tempTween.SetEase(ease);
    4.         }
    5.        
    You don't even need that ...

    Code (CSharp):
    1. [SerializeField] private Ease _ease;
    is all you need
     
    Last edited: Oct 21, 2021
  16. olleyOop

    olleyOop

    Joined:
    Nov 29, 2013
    Posts:
    9
    Hello,

    I have a question: Why is this code giving me the following error:
    Code (CSharp):
    1. for (int i = 0; i < 1; i++)
    2. {
    3.     values.Add(new List<float>());
    4.     for (int j = 0; j < 1; j++)
    5.     {
    6.         values[i].Add(10f);
    7.     }
    8. }
    9.  
    10. for (int i = 0; i < values.Count; i++)
    11. {
    12.     for (int j = 0; j < values[i].Count; j++)
    13.     {
    14.         Debug.Log($"values[{i}][{j}]:{values[i][j]}");
    15.         Tween t = DOTween.To(() => values[i][j], x => values[i][j] = x, 0, 1);
    16.     }
    17. }
    DOTWEEN ► Tween startup failed (NULL target/property - Void ThrowArgumentOutOfRangeException(System.ExceptionArgument, System.ExceptionResource)): the tween will now be killed ► Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    UnityEngine.Debug:LogWarning (object)
    DG.Tweening.Core.Debugger:LogSafeModeCapturedError (object,DG.Tweening.Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:61)
    DG.Tweening.Tweener:DoStartup<single, single, DG.Tweening.Plugins.Options.FloatOptions> (DG.Tweening.Core.TweenerCore`3<single, single, DG.Tweening.Plugins.Options.FloatOptions>) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Tweener.cs:143)
    DG.Tweening.Core.TweenerCore`3<single, single, DG.Tweening.Plugins.Options.FloatOptions>:Startup () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenerCore.cs:250)
    DG.Tweening.Core.TweenManager:Update (DG.Tweening.Tween,single,single,bool) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:533)
    DG.Tweening.Core.TweenManager:Update (DG.Tweening.UpdateType,single,single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:417)
    DG.Tweening.Core.DOTweenComponent:Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:75)

    But if I replace the I & j by a zero and a zero everything works ..

    Thanks in advance
     
  17. Birdy-Bird

    Birdy-Bird

    Joined:
    Apr 18, 2021
    Posts:
    12
    Hi, is there any way for UI tweens to be TimeScale Independent while having world tweens be TimeScale dependent?
     
  18. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    You can use

    SetUpdate(UpdateType updateType, bool isIndependentUpdate)

    to override the default setting for individual tweens. But I don't know a way to change the default by type.
     
  19. Birdy-Bird

    Birdy-Bird

    Joined:
    Apr 18, 2021
    Posts:
    12
    Thanks, this helped me!
     
    flashframe likes this.
  20. robal1991

    robal1991

    Joined:
    Mar 31, 2016
    Posts:
    20
  21. Carterryan1990

    Carterryan1990

    Joined:
    Dec 29, 2016
    Posts:
    79
    Code (CSharp):
    1.  IEnumerator Spin()
    2.     {
    3.         bool canMove = false;
    4.  
    5.         transform.DOLocalMoveY(machine.positionToReset, machine.startSpeed).SetEase(machine.startEase).OnComplete(() => {
    6.             Vector3 newPos = transform.localPosition;
    7.             newPos.y = machine.resetPosition;
    8.             transform.localPosition = newPos;        
    9.             canMove = true;
    10.  
    11.         });
    12.  
    13.         while (!canMove) yield return null;
    14.         canMove = false;
    15.  
    16.         for (int i = 0; i < reelSpins; i++)
    17.         {
    18.             transform.DOLocalMoveY(machine.positionToReset, machine.speed).SetEase(machine.reelEase).OnComplete(() =>
    19.             {
    20.                 Vector3 newPos = transform.localPosition;
    21.                 newPos.y = machine.resetPosition;
    22.                 transform.localPosition = newPos;
    23.                 canMove = true;
    24.             });
    25.             while (!canMove) yield return null;
    26.             canMove = false;
    27.         }
    28.    
    29.         transform.DOLocalMoveY(machine.stopPosition, machine.stopSpeed).SetEase(machine.stopEase).OnComplete(() =>
    30.         {
    31.             spinFinished = true;
    32.             paylineSet = false;
    33.  
    34.         });
    35.     }
    Hey Guys! I'm working on a slot machine and am trying to have the reels smoothly transition. I'm curious what you think of my approach and if you have any recommendations on how I could improve the tween. The code attached is on each of my reel objects that holds the reel icons. Thanks!
     
  22. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
  23. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    One thing you might find useful is that DOTween has a set of YieldInstructions for use in Coroutines.

    So you can say

    Code (CSharp):
    1. yield return myTween.WaitForCompletion();
    Instead of keeping track of your "canMove" variable. There are others in the documentation:

    http://dotween.demigiant.com/documentation.php#options
     
    Carterryan1990 likes this.
  24. ParallaxStudio

    ParallaxStudio

    Joined:
    Nov 6, 2017
    Posts:
    1
    Is there a way to make Sequence start at time lets say X and finish at X+Period.
    the Sequence must not stop when game is paused. Partially this is achieved by setting update to true

    Sequence.SetUpdate(true);

    but this will not work if the (mobile application) goes to background. I assume the Sequence.SetUpdate(true) means to use Time.unscaledTime over Time.time
    Is it possible to make it use Time.realtimeSinceStartup, so even if the mobile app goes out of focus when resume the Sequence will be resumed accordingly.

    example:
    Time Sequence started is 10 and the period of the Sequence is 15 seconds
    The time Sequence should finish animation is 10+15 = 25
    but if at time = 13 if the (mobile application) goes out of focus for 5 second the animation will finish at 30
    while I it should finish at 25
     
  25. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    You could use

    DOTween.ManualUpdate(float deltaTime, float unscaledDeltaTime)

    and

    SetUpdate(UpdateType.Manual, true)

    to do this, although you have to manually call the update function as implied.
     
  26. hyperkvlt

    hyperkvlt

    Joined:
    Aug 16, 2020
    Posts:
    22
    How does OnComplete() work? It always got me errors and documentations didn't make me understand....

     
  27. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    407
    onComplete != OnComplete
     
  28. hyperkvlt

    hyperkvlt

    Joined:
    Aug 16, 2020
    Posts:
    22
    Oh! Thanks! I didn't know that. The intellisense always give me that, so I thought it was right.
     
  29. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    407
    onComplete is a field that contains the reference to the OnComplete method
    Basically, the field stores information about what you want to do, but it doesn't do it ... You need to use the method to do that.
     
  30. HajiyevEl

    HajiyevEl

    Joined:
    Feb 19, 2020
    Posts:
    32
    [SOLVED] Edit > Preferences > External Tools - Regenerate Project Files solved the issue.
    Help please! Can't find namespace DG.Tweening. Almost new project, all worked just fine till now. By the way, Tweens still work and scripts compile fine. Just Visual Studio Intillisense somehow can't find namespace (i think)

     
    Last edited: Nov 9, 2021
  31. hyperkvlt

    hyperkvlt

    Joined:
    Aug 16, 2020
    Posts:
    22
    Is there a good way to use DoMove to create jump arc? DoJump was kind of buggy when I used it on my rigidbody2D. It went through the collider.
     
  32. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    Could try this recommendation from the asset's author on the old forum

    http://forum.demigiant.com/index.php?topic=26.0
     
  33. hyperkvlt

    hyperkvlt

    Joined:
    Aug 16, 2020
    Posts:
    22
    Thanks, but it seems like they don't work for me.

    Using two DoMove on rigidbody2D seems to be disabling the later one. On transform it would ignore collider.

    DoBlend only works on transform. But, the transform here could still detects collider sometimes, though.
     
  34. AbsolutelyLloyd

    AbsolutelyLloyd

    Joined:
    Jun 16, 2021
    Posts:
    1
    Was there ever a response to this? I'm trying to find the same, I'm using Default/Verbose with Safe Mode on and it claims to be catching errors (which are causing me issues, that's what I'm trying to find), but they are not in my player.log nor console before or after disabling safe mode. The safe mode error just tells me to set logging to default (despite already being default), and doesn't give me details. Any help appreciated.
     
    Last edited: Nov 10, 2021
  35. eestradaGlobant

    eestradaGlobant

    Joined:
    Oct 7, 2021
    Posts:
    1
    Greetings, everyone. I am struggling to start multiple tweens with an offset. Is that possible?

    I am starting multiple yoyo tweens, lets say:

    Code (CSharp):
    1. MovePosition(endPos, 1f)
    2. .From(startPos)
    3. .SetLoops(-1, LoopType.Yoyo)
    4. .SetAutoKill(false);
    However, I want them to start at an Offset, lets say:
    • t1= 0f
    • t2= 0.25f
    • t3= .5f
    • t4= 0.75f

      Is there any way I can force the start position of a tween like that? I am doing this because we are using a pool and I need tween positions to be in sync in relationship to other tweens, and "SetDelay" won't do it for us.
    Thanks beforehand for your help
     
  36. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    551
    .Goto(float t, bool andPlay);
     
    eestradaGlobant likes this.
  37. YD_JMysior

    YD_JMysior

    Joined:
    Aug 4, 2016
    Posts:
    35
    Hello all!
    When switching scenes I often get quite a lot of "missing target or field errors" captured by safe mode. Something like this:
    "DOTWEEN ► Target or field is missing/null () ► The object of type 'RectTransform' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object."

    I understand this is because the tween target has been destroyed by Unity on scene changing. What is the correct way to approach this? I can think of two solutions:
    A. Rely on SafeMode to catch these and ignore warnings (but I hate seeing them!)
    B. Call `DoKill` on every single tweened target inside `void OnDestroy` just in case (which gets the job done but is a little more complex when the tween was started from a non-MonoBehaviour object).
    Thanks in advance
     
  38. olleyOop

    olleyOop

    Joined:
    Nov 29, 2013
    Posts:
    9
    No one has an idea here? I'm wondering if it's a DoTween thing or a more general C# thing?
     
  39. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    407
    It's a you not implementing your for-loop correctly thing.
     
    ThomLaurent likes this.
  40. ThomLaurent

    ThomLaurent

    Joined:
    Sep 27, 2014
    Posts:
    7
    Hi I just wanted to confirm with you guys this is a bug before submitting it to GitHub issue tracker.

    I've DOTween v1.2.420 (free version) and the OnStart callback is triggered when the tween starts instead of after the delay I've put.

    The documentation says about OnStart callback:
    "Sets a callback that will be fired once when the tween starts (meaning when the tween is set in a playing state the first time, after any eventual delay)."

    Here is the code:
    Code (CSharp):
    1. Debug.Log("Call");
    2. transform.DOLocalJump(Vector3.zero, 2f, 1, 1f)
    3.          .SetDelay(1f)
    4.          .OnStart(() => Debug.Log("Start"));
    The console prints "Call" and "Start" in the same instant (maybe not same frame, but it clearly doesn't wait for 1 second)

    EDIT
    I've just opened an issue here: https://github.com/Demigiant/dotween/issues/531
     
    Last edited: Nov 28, 2021 at 12:47 PM
  41. ThomLaurent

    ThomLaurent

    Joined:
    Sep 27, 2014
    Posts:
    7
    It seems to be related to the fact this callback uses values that changes (i and j) before the tween getter and setter are called so it's a C# mistake, for this simply cache those values (so they don't change) and use them in the tween:

    Code (CSharp):
    1. for (var i = 0; i < 1; i++)
    2. {
    3.     values.Add(new List<float>());
    4.     for (var j = 0; j < 1; j++)
    5.     {
    6.         values[i].Add(10f);
    7.     }
    8. }
    9.  
    10. for (var i = 0; i < values.Count; i++)
    11. {
    12.     for (var j = 0; j < values[i].Count; j++)
    13.     {
    14.         Debug.Log($"values[{i}][{j}]:{values[i][j]}");
    15.  
    16.         var tmpI = i;
    17.         var tmpJ = j;
    18.         Tween t = DOTween.To(() => values[tmpI][tmpJ], x => values[tmpI][tmpJ] = x, 0f, 1f);
    19.     }
    20. }
     
    flashframe likes this.
  42. Mr-Zo

    Mr-Zo

    Joined:
    Aug 11, 2014
    Posts:
    4
    Hi, I've got some weird easing problem.

    I scripted a simple move with 'OutExpo' easing option in a sequence.

    Code (CSharp):
    1. _jumpSeq = DOTween.Sequence();
    2. _jumpSeq.Append(Tr_Box.DOLocalMoveY(300f, 1f, false)) .SetEase(Ease.OutExpo);
    3. _jumpSeq.SetAutoKill(false);
    4. _jumpSeq.Pause();
    It played as I expected.



    But when I appended a next tween to make a jump-like movement, something went wrong.

    Code (CSharp):
    1. _jumpSeq = DOTween.Sequence();
    2. _jumpSeq.Append(Tr_Box.DOLocalMoveY(300f, 1f, false)) .SetEase(Ease.OutExpo);
    3. _jumpSeq.Append(Tr_Box.DOLocalMoveY(-100f, 1f, false)).SetEase(Ease.InExpo);
    4. _jumpSeq.SetAutoKill(false);
    5. _jumpSeq.Pause();
    The both tween's easing seemed to be replaced with each other. (The first tween's easing is different from the above clip.)



    If you have any clue, please let me know. Thanks.
    (Unity 2021.2.1f1 & 2019.4.32f1, DOTween 1.2.623)
     
    Last edited: Nov 20, 2021
  43. ThomLaurent

    ThomLaurent

    Joined:
    Sep 27, 2014
    Posts:
    7
    My clue is try to SetEase within your tween instead of in the sequence, so like this:
    Code (CSharp):
    1. _jumpSeq = DOTween.Sequence();
    2. _jumpSeq.Append(Tr_Box.DOLocalMoveY(300f, 1f, false).SetEase(Ease.OutExpo));
    3. _jumpSeq.Append(Tr_Box.DOLocalMoveY(-100f, 1f, false).SetEase(Ease.InExpo));
    4. _jumpSeq.SetAutoKill(false);
    5. _jumpSeq.Pause();
     
    flashframe likes this.
  44. Mr-Zo

    Mr-Zo

    Joined:
    Aug 11, 2014
    Posts:
    4

    Wow, you're right. It works as I intended.
    Thank you very much, indeed!!!
     
  45. studiolumiere_unity

    studiolumiere_unity

    Joined:
    Apr 24, 2020
    Posts:
    20
    Hello,
    I'm using 'DOTweenTMPAnimator' to use a system that smoothly outputs a string.
    I was wondering what could be the cause of the error while using 'DOTweenTMPAnimator'.
    Reproducing errors 100% in tests is difficult.

    - code example -

    protected TextMeshProUGUI _scriptTmpText;

    _scriptTmpText.text = "... Est-ce si difficile d'y entrer ?" // Only this sentences will cause an error. (Most other sentences are possible.)

    var doTweenTmpAnimator = new DOTweenTMPAnimator(_scriptTmpText); // this point error

    - error -
    IndexOutOfRangeException: Index was outside the bounds of the array.
    DG.Tweening.DOTweenTMPAnimator+CharTransform.Refresh (TMPro.TMP_TextInfo textInfo, TMPro.TMP_MeshInfo[] cachedMeshInfos) (at Assets/Plugins/Demigiant/DOTweenPro/DOTweenTextMeshPro.cs:902)
    DG.Tweening.DOTweenTMPAnimator+CharTransform..ctor (System.Int32 charIndex, TMPro.TMP_TextInfo textInfo, TMPro.TMP_MeshInfo[] cachedMeshInfos) (at Assets/Plugins/Demigiant/DOTweenPro/DOTweenTextMeshPro.cs:890)
    DG.Tweening.DOTweenTMPAnimator.Refresh () (at Assets/Plugins/Demigiant/DOTweenPro/DOTweenTextMeshPro.cs:284)
    DG.Tweening.DOTweenTMPAnimator..ctor (TMPro.TMP_Text target) (at Assets/Plugins/Demigiant/DOTweenPro/DOTweenTextMeshPro.cs:236)
    CGM.GeneralCode.VisualNobel.DialogueController.Run (System.String script, UnityEngine.Color scriptColor, System.Int32 textTypingSpeed, CGM.GeneralCode.PositionCode positionCode, System.Boolean isShake) (at Assets/CookieGameManager/GeneralCode/Scene/VisualNobelGame/DialogueController.cs:79)

    - error detail point -
    Code (CSharp):
    1.  
    2.  public void Refresh(TMP_TextInfo textInfo, TMP_MeshInfo[] cachedMeshInfos)
    3.  {
    4.      TMP_CharacterInfo charInfo = textInfo.characterInfo[charIndex];
    5.      bool isSpaceChar = charInfo.character == ' ';
    6.      isVisible = charInfo.isVisible && !isSpaceChar;
    7.      _matIndex = charInfo.materialReferenceIndex;
    8.      _firstVertexIndex = charInfo.vertexIndex;
    9.      _meshInfo = textInfo.meshInfo[_matIndex];
    10.      Vector3[] cachedVertices = cachedMeshInfos[_matIndex].vertices;
    11.      _charMidBaselineOffset = isSpaceChar // this point error
    12.      ? Vector3.zero
    13.      : (cachedVertices[_firstVertexIndex] + cachedVertices[_firstVertexIndex + 2]) * 0.5f;
    14. }
     
    Last edited: Dec 1, 2021 at 6:36 AM
  46. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    235
    Hey all. I'm trying to implement a simple elevator system using the DoTweenAnimation component in which the speed is consistent and I can change the target Y position mid-tween. Essentially I just have a list of Vector 3 that is moving an object locally, and it calls a method that updates the start and end values. However, I noticed that the speed seems to vary based on the distance between the start and end values. I've never used Tweens in this context and am a bit confused

    Code (CSharp):
    1. public void UpdateElevatorTargetPosition(Vector3 position)
    2. {
    3.        ((Tweener)tween).SetEase(Ease.Linear);
    4.        ((Tweener)tween).SetSpeedBased(true);
    5.        ((Tweener)tween).ChangeStartValue(transform.localPosition);
    6.        ((Tweener)tween).ChangeEndValue(position);
    7.        DOPlay();
    8. }
    I'm assuming that how I am going about this is either overriding and setting the speed based value to false, or the amount of movement is calculated prior to playing and something needs to be called to update the amount it's expected to move per frame? The position updates as expected, it's just the variation in speed that I'm unsure about how to fix
     
    Last edited: Dec 2, 2021 at 6:02 AM
unityunity