Search Unity

DOTween (HOTween v2), a Unity tween engine

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

  1. ooblii

    ooblii

    Joined:
    Feb 23, 2013
    Posts:
    30
    If anyone runs into the same issue with DOShakeRotation and UNET, I solved my problem by using DOTween Pro. I attached a DOTweenAnimation component to my shield object and accessed it via script.

    Original code:
    Code (CSharp):
    1. myShield.transform.DOShakeRotation(.5f,50f,10,0,true);
    Code w/ DOTweenPro:
    Code (CSharp):
    1. DOTweenAnimation myTween = myShield.GetComponent<DOTweenAnimation>();
    2. myTween.DORestart();
     
  2. liquify

    liquify

    Joined:
    Dec 9, 2014
    Posts:
    187
    Hi, thanks for the amazing tweening script. Currently I have a problem. I would like to pass a callback to a method, but I got an error. Here is my script:

    Code (CSharp):
    1. void Start()
    2. {
    3. TestMoveRotateScale(()=>TestCallback("AAAAAAAAAAAA", "BBBBBBBBBBBBBBB"));
    4. }
    5.  
    6. public void TestCallback(string testString0, string testString1)
    7.     {
    8.         Debug.Log(testString0 + testString1);
    9.     }
    10.     public void TestMoveRotateScale(TweenCallback callback)
    11.     {
    12.         Sequence mySequence = DOTween.Sequence;
    13.         mySequence.Append(cubeA.DOMove(new Vector3(-2f, 2f, 0f), 2f).SetRelative().SetEase(Ease.InOutElastic));
    14.         mySequence.AppendCallback(callback);
    15.     }
    The error is:

    How to pass a callback to a method?
     
  3. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798

    EDIT: My bad. You need to add parentheses to DoTween.Sequence()

    Code (CSharp):
    1. Sequence mySequence = DOTween.Sequence();
     
  4. paradizIsCool

    paradizIsCool

    Joined:
    Jul 10, 2014
    Posts:
    178
    Hi,

    I have a question about Complete and Sequence. When I call Complete the callbacks are called, but the tweeners included in the Sequence are not going to the end position (even with withCallbacks to true).

    How can I send my sequence and included tweener to the end position ?
     
  5. liquify

    liquify

    Joined:
    Dec 9, 2014
    Posts:
    187
    Thanks @flashframe
     
  6. alfa1993

    alfa1993

    Joined:
    Aug 20, 2015
    Posts:
    26
    Hello,
    I want to thank you for this great powerful animation tool. I had one question. If I donate to your site, can I be able to get the pro version in case I need it (free version has everything I need:)).
    One suggestion: add a method like setautoplay, so we do not need to set it at the general setting for all tweeners true or false. I mean if one of our tweeners needs to initialize but we do not want to start but just to assign, but others can be played autommatically.
     
  7. N3V-Developer

    N3V-Developer

    Joined:
    Jun 7, 2014
    Posts:
    20
    Hi I was not able to find information about branching and other required stuff.

    For a small game extension part I require a rail lore system. Means I want to move objects along a spline with normalized variable speed on Bezier points (not catmull) and have branching/junctions. The object should be moved over a junction back and forward without loosing it's direction.

    For sure I want to have an editor is able to lay splines and connect at last 3 spline points to a branch
    Rotate handles of the the connected splines synchronous. Thats possible?
     
  8. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Hi, I have Dotween Pro and was wondering is there a way to have a Dotween animation loop using the delay every time it loops?
    My editor settings are a delay of five seconds and then it is set to a loop count of -1. I want it to loop with the 5 second delay. I can easily do it with playmaker but am hoping for a way to include the delay in the loop... Thx!
     
  9. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    Hey I'm new to DOTween. I'm tweening a rectTransform's anchorPos and its instantly teleporting to the goal value. The duration is 0.5 and I'm not doing .From() or anything like that. Are there any simple mistakes I've made?
    Code (csharp):
    1.  
    2. rectTransform.DOAnchorPos (OffscreenLeftPosition (), tweenDuration);
    3.  
     
  10. john_hattan

    john_hattan

    Joined:
    Aug 28, 2013
    Posts:
    11
    I'm actually following up on a feature request from the old (read-only) forum.

    http://forum.demigiant.com/index.php?topic=18.0

    Did this ever get implemented? I'm currently using a rather ugly parenting-unparenting hack that I wish I could dump.
     
  11. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Hi,
    I just stumbled onto this asset. I have a question.
    I noticed on the video on the asset store that you use separate monobehaviours to set up different tweens from the Inspector. Is there a reason for that? Having so many monobehaviours means taking up as many slices of frame time of the main thread as the number of MonoBehaviours you've created(same thing if you use Coroutines...they do take up slices of time as well).
    Do you do any kind processing prior to playing to mitigate it?
    If not, why not have a single script with an custom Editor(inspector or window) that lets you do all the design in one place or gives you a framework to do so and does stepping or whatever on the whole list of tweens which should be much quicker and way lighter on the runtime?!

    I guess a user can do so using the scripting API by herself but it would be a bit counterproductive as to using regular tween packages or rolling own, so I was wondering what the design philosophy was.
    Also I did not find sth to the contrary, so I thought to ask at the source, sorry if it's been said before but this thread is long and wasn't mentioned in the official website or FAQ.

    Thanks,
    N
     
  12. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Hi there

    I am fading in and out the alpha of images in one event, is there a way to simplify this:
    Code (CSharp):
    1. for (int i = 0; i < _images.Length; i++) {
    2.             Tween tween = _images[i].DOFade(1.0f, 0.35f).SetEase(Ease.InSine);
    3.  
    4.             _sequence.Insert(0.0f, tween);
    5.  
    6.             tween = _images[i].DOFade(0.0f, 0.35f).SetEase(Ease.OutSine);
    7.  
    8.             _sequence.Insert(0.35f, tween);
    9.         }
    Also, when I execute _sequence.Play() or _sequence.PlayForward() it won't let me execute it again. What am I doing wrong? I want to execute this as many times as users choose to.

    Thanks
     
  13. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Try using _sequence.Restart()
     
  14. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thanks @flashframe It doesn't work either.

    I am getting the alpha value of images changed from 0f to 1f and then back to 0. The Sequence works fine the very first time this object is tapped. If you tap a second time, or third, etc OnPointerUp is called but _sequence.Restart() won't play the Tweens.

    Thank

    This is my script:
    Code (CSharp):
    1. using UnityEngine.EventSystems;
    2. using UnityEngine;
    3. using System;
    4. using UnityEngine.UI;
    5. using DG.Tweening;
    6.  
    7. public class BackgroundController : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
    8.  
    9.     public Image[] _images;
    10.     Sequence _sequence;
    11.  
    12.     void Awake () {
    13.         _sequence = DOTween.Sequence();
    14.     }
    15.  
    16.     void Start () {
    17.         for (int i = 0; i < _images.Length; i++) {
    18.             Tween tween = _images[i].DOFade(1.0f, 0.35f).SetEase(Ease.InSine);
    19.  
    20.             _sequence.Insert(0.0f, tween);
    21.  
    22.             tween = _images[i].DOFade(0.0f, 0.35f).SetEase(Ease.OutSine);
    23.  
    24.             _sequence.Insert(0.35f, tween);
    25.         }
    26.         _sequence.Pause();
    27.     }
    28.  
    29.     public void OnPointerDown(PointerEventData eventData) {
    30.      
    31.     }
    32.  
    33.     public void OnPointerUp(PointerEventData eventData) {
    34.         _sequence.Restart();
    35.     }
    36. }
     
    Last edited: Jun 6, 2017
  15. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Do you have auto kill set to true in your default settings? If so, you need to override that setting on your sequence


    Code (CSharp):
    1.     void Awake () {
    2.         _sequence = DOTween.Sequence().SetAutoKill(false);
    3.     }
     
  16. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    @flashframe thank you so much. It worked!

    I was playing with my code and found a scenario where the tween will not play completely when using PlayForward() and PlayBackward() so I was wondering if there is way to force the tween to complete. I tried .Complete() but somehow it isn't working. I undid all my changes so I lost all that experimentation so I am sorry I can't show you.

    Thanks again!
     
  17. Telso02

    Telso02

    Joined:
    May 17, 2017
    Posts:
    5
    Hi everyone, Apologies if this has been brought up before.

    Just got into Dotween pro, How does one go about instantiating a spline path entirely in C#, so i can control where the way points are placed, how many of them there is, object that follows the path etc.

    So far i've only found a way to tween an object to a position, but no way to specify the other details i need.

    If anyone can lend me a hand or point in the direction of some documentation, that would be greatly appreaciated.

    Thanks,
    Tom.
     
  18. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68
    Hi everyone,
    I was wondering...is there any way to use DoTween to do something like "navMeshAgent.DoSpeed( speed, duration.. )"
     
  19. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Difficult to say without knowing more details. What part of the tween/sequence doesn't play? Are you interrupting it? Is it callbacks that aren't firing?
     
  20. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Don't know if there's a shortcut for it, but you can tween any float value using the generic method:
    http://dotween.demigiant.com/documentation.php#genericTo

    Code (CSharp):
    1. // Tween a float called myFloat to 52 in 1 second
    2. DOTween.To(()=> myFloat, x=> myFloat = x, 52f, 1);
     
  21. clarklak11

    clarklak11

    Joined:
    Aug 26, 2016
    Posts:
    22
    How can I move an object to the top right corner of the screen?
     
  22. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Hey all,

    I am using WaitForCompletion() to yield until my tween is complete for UI animation. Basically I have a series of slide in/slide out panels, and when collapsing the stack I have to wait for each in turn to complete before starting the next.

    Problem I am seeing though is there is a noticeable delay between when I visually see the animation complete, and when the yield returns and the next starts.

    Code (CSharp):
    1.                 if (this.CurrentPanel != null && !string.Equals(newPanel.ScreenName, this.CurrentPanel.ScreenName, StringComparison.InvariantCultureIgnoreCase))
    2.                 {
    3.                     Debug.Log("Changing UI Screens");
    4.                     // New panel is in a different screen from the current one, so we need to pop the panel stack to close all current panels then open the new one
    5.                     for (int i = this.OpenPanels.Count - 1; i >= 0; i--)
    6.                     {
    7.                         Tween panelMove = this.OpenPanels[i].PanelObject.GetComponent<RectTransform>().DOAnchorPosX(this.OpenPanels[i].ClosedPosition, PanelAnimationTime, false);
    8.                         yield return panelMove.WaitForCompletion();
    9.                     }
    10.  
    11.                     // clear the stack
    12.                     this.OpenPanels.Clear();
    13.                     // And the current panel (Since we just closed them all)
    14.                     this.CurrentPanel = null;
    15.                 }
    16.  
    Anyone know what I might be doing wrong?
     
  23. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Hey, you can create an array of Vector3 waypoints and use DOPath to tween a Transform along the spline. More details are n the docs:

    http://dotween.demigiant.com/documentation.php?api=DOPath
     
  24. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Could it have something to do with the default ease applied to your tweens? If you've got a strong ease it could appear that the object has reached its goal even though it's still moving a tiny amount. Try putting in a couple of debugs to the console to see if the yield duration is the same as the tween duration.
     
  25. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
  26. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Ease was linear at the time of testing.
     
  27. shrinebot

    shrinebot

    Joined:
    Sep 12, 2014
    Posts:
    16
    Hi all,

    Just wondering if there is a way to get the time (in secs) between waypoints on a path, or rather the start-time/end-time of a waypoint?

    Basically what I want to do is tween a paths timescale down, say 1 sec before it reaches the next waypoint - essentially smooth decelerating before reaching the waypoint.

    Thanks, gotta love DoTween ;)
     
  28. harsanalif

    harsanalif

    Joined:
    Nov 10, 2013
    Posts:
    1
    Help! I can't access DOMove and DORotate for RIgidBody2D.
    I always get error:
    Assets/Games/Script/Games.cs(42,39): error CS1928: Type `UnityEngine.Rigidbody2D' does not contain a member `DORotate' and the best extension method overload `DG.Tweening.ShortcutExtensions43.DORotate(this UnityEngine.Rigidbody2D, float, float)' has some invalid arguments

    Any help will be greatly appreciated!
     
  29. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Sounds like there's an error in your code. That kind of error message is always slightly confusing, but the important bit is "invalid arguments". At a guess, you might not be passing floats. Don't forget to add an "f" :)
     
  30. elmax

    elmax

    Joined:
    Oct 6, 2013
    Posts:
    19
    Same problem here! Using dotween for years and love it.

    Now started using Wwise (because the soundengineer I work with loves it) - and after executing wwise integration, dotween fails so bad... Assembly doesn't show the dotween dlls anymore, API Updater fails with "DG - classes in the module cannot be loaded", furthermore namespace DG cannot be found anywhere in scripts.

    Both dotween and wwise work perfectly fine apart from each other - never together.

    Have you ever found a solution to this ???
    Any help most welcome!
     
  31. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68

    Hi~
    I really got confused about the DoTweenAnimation component.
    I just wanna play the animation again every time I tap the button in the runtime, and with the animation's loop set to fixed number.
    But it doesn't work with the OnClick set to DoTweenAnimation.DoPlay. Did I set something wrong?
    I mean you can play it again easily when you call the method in the script like:
    Code (CSharp):
    1. public void Play(){
    2.     transform.DoMove(...);
    3. }
     
    Last edited: Jun 27, 2017
  32. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    You might need to turn off AutoKill.
     
    dearamy likes this.
  33. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Does anyone know if OnComplete(TweenCallback callback) works after a sequence is called.

    Like this: _sequence.Restart().OnComplete(OpacitySwitch);
    _sequence is of type Sequence.

    In the documentation page the sections that reads 'tweener and sequence settings' lists OnComplete and even has en example, using a tween that is.

    Thanks
     
    Last edited: Jun 30, 2017
  34. syamilsynz

    syamilsynz

    Joined:
    Dec 22, 2013
    Posts:
    31
    Hello,

    I can't use animation fade and animation color when I implement it on SVG renderer using SVG Importer asset.

    can it be done or is there any tricks? thanks.

    # 303149569
     
  35. Deleted User

    Deleted User

    Guest

    I think I found a bug where setting the DOTweenAnimation to localMove and the To to a value less than 0.5 will make it not not move at all.
     
  36. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Hi, Daniele! My call to DOVirtual.DelayedCall wouldn't work. Figured out that I had to call Play() on it as otherwise it won't start. Since my AutoPlay is set to Tweeners only, does that mean that DelayedCall operates through a sequence?
    If that's the case, it would probably be a good idea to mention it in the docs.
     
  37. KJoanette

    KJoanette

    Joined:
    Jun 8, 2013
    Posts:
    59
    DoTween doesn't seem to be respecting my time scale. I'm forcing the tweens to use SetUpdate( false ) but with timeScale set to 0 I am still getting movement from the tweens (nothing else moves these objects).

    EDIT: It also doesn't respect DOTween timescale if I set it to true and that timeScale to 0
     
    Last edited: Jul 10, 2017
  38. Sprudelmann

    Sprudelmann

    Joined:
    Jul 11, 2017
    Posts:
    1
    Hi everbody,

    just implemented Pro Version to Unity 5.6.2 and have a Problem, which is so astonishing easy (or stupid) but I dont get it.
    When I start a Tween Fade first time all is fine, when I do it again on the same SpriteRenderer strange things happen:

    Works (all times called):
    mBackSprite.DOKill();
    mBackSprite.DOFade(1, 0);
    mBackSprite.DOFade(0, 1.5f).SetDelay(1);
    Does not Work 1 (second call: vanishes after 2.5 seconds without fade) :
    DOTween.KillAll(true, mBackSprite);
    mBackSprite.DOFade(1, 0);
    mBackSprite.DOFade(0, 1.5f).SetDelay(1);
    Does not Work 2 (second call: does not show anyhing, alpha is till 0):
    mBackSprite.DOKill();
    mBackSprite.DOFade(0, 1.5f).ChangeStartValue(1).SetDelay(1);

    Any help is appreciated, I did not found any clue in the docs.
     
  39. chyen

    chyen

    Joined:
    Sep 1, 2014
    Posts:
    9
    Hi I am a new DOTween user here.

    I have problem implementing Dynamic Health Bar in my game.

    Update(){
    tweener = transform.DOScaleX (heroHealthPoint, 0.50f);
    tweener.OnUpdate (() => tweener.ChangeEndValue (heroHealthPoint, true));
    }

    It works in game however it creates around 150-200 tweens per frame according to the Log, which slowing down my game slightly when I have tons of tween running together.

    Is there a way to make it a Single tween that handle the bar scaling which can be placed in One-time method like OnEnable()?

    Thanks!
     
  40. jingray

    jingray

    Joined:
    Feb 6, 2015
    Posts:
    53
    How to create move path with code. I dont use visual editor path ?!. Thanks
     
  41. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    Hi,

    While working on a project I got this message.

    DOTWEEN :: Error in RemoveActiveTween.totActiveTweeners. It's been taken care of so no problems, but Daniele (DOTween's author) is trying to pinpoint it and it would be awesome if you could reproduce this log in a sample project and send it to him. Or even just write him the complete log that was generated by this message. Fixing this would make DOTween slightly faster. Thanks.
    UnityEngine.Debug:Log(Object)
    DG.Tweening.Core.Debugger:Log(Object) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:22)
    DG.Tweening.Core.Debugger:LogRemoveActiveTweenError(String) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:70)
    DG.Tweening.Core.TweenManager:RemoveActiveTween(Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:898)
    DG.Tweening.Core.TweenManager:Despawn(Tween, Boolean) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:199)
    DG.Tweening.Core.TweenManager:DespawnActiveTweens(List`1) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:852)
    DG.Tweening.Core.TweenManager:Update(UpdateType, Single, Single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:430)
    DG.Tweening.Core.DOTweenComponent:Update() (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs:51)

    ----

    IndexOutOfRangeException: Array index is out of range.
    DG.Tweening.Core.TweenManager.GetTweener[Color,Color,ColorOptions] () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:65)
    DG.Tweening.DOTween.ApplyTo[Color,Color,ColorOptions] (DG.Tweening.Core.DOGetter`1 getter, DG.Tweening.Core.DOSetter`1 setter, Color endValue, Single duration, DG.Tweening.Plugins.Core.ABSTweenPlugin`3 plugin) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:973)
    DG.Tweening.DOTween.ToAlpha (DG.Tweening.Core.DOGetter`1 getter, DG.Tweening.Core.DOSetter`1 setter, Single endValue, Single duration) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:431)
    DG.Tweening.ShortcutExtensions46.DOFade (UnityEngine.UI.Text target, Single endValue, Single duration) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween46/ShortcutExtensions46.cs:454)
    MainGUIController.<Init>m__1 () (at Assets/scripts/controller/MainGUIController.cs:68)
    UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:154)
    UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:637)
    UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:773)
    UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:52)
    UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
    UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
    UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update()

    It happens after I reload the same scene using
    Code (CSharp):
    1. public void Reset(){
    2.         DOTween.Clear();  //unsure if this is required, but it seems sensible
    3.         SceneManager.LoadScene(1);
    4. }
    The scene starts by pressing a button that moves the button out of the screen and initiates a fade on a image and some text. (I'm guessing this is what the error is about) I hope this helps you in resolving this problem!

    Regards,


    ps. I made sure to update to the latest version (1.1.620)
     
  42. Finity

    Finity

    Joined:
    Jan 25, 2013
    Posts:
    10
    Does thos work with Unity 2017.1?
     
  43. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Hey,

    Is there anyway you can either release a .dll version of this, or give a specific walkthrough on how to properly turn your code into a .dll?

    [Edit -- Whoops. You actually already do basically do this outside of a couple of files. Never mind ... not used to 3rd party assets doing this :) Should have double checked, sorry!]
     
    Last edited: Aug 3, 2017
  44. GoalLine

    GoalLine

    Joined:
    Mar 23, 2017
    Posts:
    8
    Im using Unity2017.
    Does Image.DoFillAmount(endValue, duration) work?
    I cant get it to work and I'm about to give up and just Mathf.MoveTowards.
    I call my function with a float parameter of 0.8f, and log happens but it fill amount never changes.
    Yes the Image is loaded on the inspector. :(
    Code (CSharp):
    1.  
    2. [SerializeField] private Image gauge = null;
    3.  
    4. private void UpdateFuelGauge(float endValue){
    5.         Debug.Log ("UpdateFuelGauge - " + endValue);
    6.         gauge.DOFillAmount (endValue, 0.5f);
    7. }
     
  45. GoalLine

    GoalLine

    Joined:
    Mar 23, 2017
    Posts:
    8
    OMG! Im gonna kill myself. My default settings my of DoTween has automatic play turned off. I got it working by calling play.
    Code (CSharp):
    1. gauge.DoFillAmount (endValue, 0.5f).Play();
     
  46. DemyHallar

    DemyHallar

    Joined:
    Oct 18, 2015
    Posts:
    3
    Hi, I'm building my project with the Cloud Build and iOS build runs ok and everything is fine, but Android build crushes with the error:

    CS0246: The type or namespace name `DG' could not be found. Are you missing an assembly reference?

    This error appeared only after Unity update (to the last stable version). Before the update both builds worked.
    And, yes, of course I'm adding
    "using DG.Tweening;"
    wherever I use it.
     
  47. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm trying to get DOLookAt to work for 2D sprites and couldn't figure out how so I searched this thread and found the following advice:

    But this makes no sense to me. DoPath seems to be its own function for moving an object along a path. I don't want to use DOPath to move the object. I just want to use DOLookAt so that it is oriented to a target object so then I can use DOMove to move it there. How can I get DOTween into this TopDown2D mode so DOLookAt will work for my 2D sprites?
     
  48. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Can we see the code that doesn't work?
     
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    There's really nothing to see, but here's the basic idea:

    Code (CSharp):
    1. transform.DOLookAt(target.position, 1f);
    2. transform.DoMove(target.position, 8f);
    I've tried adding an AxisConstraint to DOLookAt, but no option works. The sprite is always oriented in 3D space instead. Also tried specifying an up vector, but nothing works there either. I'm interest mostly in getting DOTween to treat this as 2D and when I searched the forums someone had said to use DOPath to set that 2D mode, but I don't want to use DOPath to move the sprite.
     
  50. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    If you want to rotate something along the Z-axis, you could use Mathf.Atan2 to get the angle, and then use DOLocalRotate to rotate the sprite. Something like this:

    Code (CSharp):
    1. public void LookAt()
    2. {
    3.      Vector3 distance = sprite1.position - sprite2.position;
    4.      float rotZ = Mathf.Atan2(distance.y, distance.x) * Mathf.Rad2Deg;
    5.  
    6.      sprite1.DOLocalRotate(new Vector3(0,0,rotZ), 0.5f).Play();
    7. }