Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

DOTween (HOTween v2), a Unity tween engine

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

  1. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    427
    WOW! Thank you!
     
  2. cranecam

    cranecam

    Joined:
    Nov 25, 2013
    Posts:
    25
    how come it takes a float as an index? (from your website). What if I wanted to go to 3'rd last index, how would that be done? (using array.Length-3 maybe?)

    GotoWaypoint(float waypointIndex, bool andPlay = false)
    Works only with paths tweens and from Tween or Tweener instances.
     
  3. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    @Izitmee Solved it by creating some custom code. Ill look into the sequencer.
     
  4. jodev

    jodev

    Joined:
    Apr 16, 2013
    Posts:
    4
    Hi,

    I'm probably missing something obvious, but I'm running into a slight problem. I'm trying to move a (rotated) camera a given distance along its local z-axis (as if zooming out). The camera is child of an empty GameObject. Increasing the z-value would should move it along the camera z-axis away from the GameObject. When using vanilla Unity C# code, without lerping, I could write:

    Code (CSharp):
    1. _camera.transform.Translate(new Vector3(0f, 0f, distance), Space.Self);
    I am trying to find the DOTween version of Space.Self. I tried using _camera.transform.DoLocalMoveZ() as well as DOTween.ToAxis() using the camera's transform localPosition. Both resulted in the camera moving along the world z-axis. Any clue what I might do wrong? Thanks!
     
  5. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @cranecam It's an error in the online documentation (fixed now). It takes an int indeed.

    @jodev Hi! DOLocalMove/X/Y/Z moves inside the parent's internal space (as if you directly changed the localPosition.z of the child). So if you want to move along a rotated Z axis, you'll need to first rotate the parent, not the child.
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    PLAYMAKER ACTIONS! YUP!

    dudebxl created a set of DOTween actions for PlayMaker. If you're excited by this news, you can find them here. Bow to dudebxl!!! :)

    dotween_playmaker.jpg
     
  7. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    427
    Hi, I just find a interesting asset named Chronos https://www.assetstore.unity3d.com/en/#!/content/31225
    Basically it's a time controller, but I find that DOTween doesn't work well with it, I guess that's because DOTween have it's own time scale system.
    Does DOTween support reading time scale from other asset? Thanks

    UPDATE: I see the issue on Github https://github.com/Demigiant/dotween/issues/19
    Hmm.. Is it ready now? I may attend an indie game jam this weekend and wanna make something with Chronos and DOTween :)

    AND another problem, how to slow down the time scale smoothly? Use DOTWeen itself to tween DOTween.timeScale to 0 seems a very tricky problem, since it may never get done isn't it?
     
    Last edited: Jul 9, 2015
  8. noania

    noania

    Joined:
    Apr 19, 2014
    Posts:
    33
    Hi, can I ask a question?

    I'm applying a simple "FromTo" tween like this but it's not working(the transform's starting scale is not changed)

    transform.DOScale(1f, 0.4f).ChangeStartValue(0f);


    whereas the code below works

    transform.localScale = Vector3.zero;
    transform.DOScale(1f, 0.4f);


    Am I doing something wrong?
     
    tttk likes this.
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @zhuchun I just wrote Chronos' author to try and see what can I do. Hope to be able to work on it (if doable) within the end of next week. Sorry for not being ready for the weekend (and for the delayed answer).

    About animating DOTween's timescale, I never thought about that. I mean, single tween's timescales can be tweened indeed, but as you mention tweening DOTween's global one would be messy. I could implement a "fully independent tween" option, that would make tweens independent from DOTween's timeScale too. Will think about that.

    @noania Never thought to use ChangeStartValue like that, but yes, it won't work like that because the tween has not yet been initialized. I'd suggest going for your second approach in this case.
     
    tttk and zhuchun like this.
  10. jodev

    jodev

    Joined:
    Apr 16, 2013
    Posts:
    4
    Apologies for the late reply. I was hoping to be able to do so without adding more stuff to the hierarchy, but it'll do. Thanks!

     
  11. noania

    noania

    Joined:
    Apr 19, 2014
    Posts:
    33
    Thanks for clarifying. Nothing a big deal but as a lazy coder I hope "FromTo" will be implemented someday.
     
  12. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    I was wondering if it was easy to scale animations with DOTween. I want to have objects moving in a figure 8 pattern and I want to be able to make the figure 8 larger or smaller and have the objects moving at different speeds. I know that it is easy to have different speeds of animation, how about making the animation larger or smaller? Thanks in advance.
     
  13. catbandit

    catbandit

    Joined:
    Apr 15, 2015
    Posts:
    4
    Hi,

    I am using the DoTween Pro version. I want to have a panel that slides out from the left side of the window and after a couple of seconds slides back in using a different move algorithm. I have added two DoTweenAnimation scripts to the game object, set them up and named them with different ids - NotificationOut and NotificationIn. In my show function I first rewind and than play both tweens.

    Code (CSharp):
    1. panel.gameObject.GetComponent<DOTweenAnimation> ().DORewind ();
    2. panel.gameObject.GetComponent<DOTweenAnimation> ().DOPlayById ("NotificationOut");  
    3.  
    4. yield return new WaitForSeconds(2.5f);
    5.  
    6. panel.gameObject.GetComponent<DOTweenAnimation> ().DOPlayById ("NotificationIn");
    7.  
    My questions are:
    1. Is this the correct way to use the component when having multiple tweens attached to the same game object.
    2. How can I subscribe for the onCompleted event of the second tween - NotificationIn.

    Thanks in advance
     
  14. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    427
    Ha, never mind, my team finish the game with Chronos & DOTween, I'm the only coder though.
    Now I'm trying to polish the 48hr game and send it to the China's biggest indie festival, I can't translate it immediately since the deadline is so close(this weekend!Gee...)
    We set the global timescale to a very small value like 0.1f eventually, the final result looks pretty cool in fact.
    Anyway, It's glad to see you are working together, Cheers! :)
     
    Last edited: Jul 13, 2015
  15. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Using Pro, my ugui elements seem to tween to the wrong position. I didnt change anything. Any idea?
     
    Last edited: Jul 15, 2015
  16. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    I have a tween animation that is a recoil effect for a rifle. I have auto start and auto kill off. Every time the rifle fires I want to play the recoil tween. The first rifle recoil I call DOPlay and each time after that I call DORestart. If I call DOPlay every time it only works the first time, that is why I am using DORestart the subsequent calls to the tween.

    That is fine and all but it is an inconvenience having to keep track of the first play of the tween to know whether to call DOPlay or DORestart. Is there an easier way to do this?

    Update: I just realized that the rifle position gets reset on DORestart to the position it was in during the DOPlay. That is another issue. Is there a way to just reset the tween without recreating it through code each time?

    Thanks!
     
    Last edited: Jul 16, 2015
  17. oops64

    oops64

    Joined:
    Jul 2, 2015
    Posts:
    4
    maybe it works!
    DOTween.To(()=>mFloatX,x=>mFloatX=x, toValue, 0.3f).OnUpdate(TranslateZ);
    voidTranslateZ()
    {
    trans.Translate( Vector3.forward * mFloatX * Time.deltaTime);
    }
     
  18. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    299
    Hello!

    I have a tween when a sprite appears. The problem is that I dont know how to reuse the tween. If I call the tween each time, everything is fine, but if I try to reuse it, I dont get any effect, altougth I can see in [DOTween] that a tween is being played. Here is my code if it can help.

    Code (CSharp):
    1. using DG.Tweening;
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class AppearEffect : MonoBehaviour
    6. {
    7.     public Vector3 startSize;
    8.     public float duration;
    9.     public Ease ease;
    10.  
    11.     private Tween appearTween;
    12.  
    13.     private CostumeController costumeController;
    14.  
    15.     private void Awake()
    16.     {
    17.         costumeController = this.GetComponent<CostumeController>();
    18.     }
    19.  
    20.     private void Start()
    21.     {
    22.         CreateTween();
    23.     }
    24.  
    25.     private void OnEnable()
    26.     {
    27.         costumeController.OnSelectedCostume += OnSelectedCostume;
    28.         //DoEffect();
    29.     }
    30.  
    31.     private void OnDisable()
    32.     {
    33.         costumeController.OnSelectedCostume -= OnSelectedCostume;
    34.     }
    35.  
    36.     private void CreateTween()
    37.     {
    38.         appearTween = this.transform.DOScale(Vector3.one, duration).SetEase(ease).SetAutoKill(false);
    39.  
    40. //DoEffect(); If I uncomment this line, everything works. It is like the tween needs to start or Init somehow
    41.     }
    42.  
    43.     private void OnSelectedCostume(CostumeController costumeController)
    44.     {
    45.         DoEffect();
    46.     }
    47.  
    48.     private void DoEffect()
    49.     {
    50.         //this.transform.do
    51.         this.transform.localScale = startSize;
    52.         appearTween.Rewind(); // I tried with appearTween.Restart() too
    53.         appearTween.Play();
    54.  
    55. //If instead of trying to reuse the tween, I use directly
    56. //this.transform.DOScale(Vector3.one, duration).SetEase(ease), everything works
    57.    
    58.     }
    59.  
    60.     private void Reset()
    61.     {
    62.         startSize = Vector3.one*0.2f;
    63.         duration = 1.0f;
    64.         ease = Ease.OutElastic;
    65.     }
    66. }
    67.  
     
    Last edited: Jul 16, 2015
  19. Gigacee

    Gigacee

    Joined:
    Mar 4, 2015
    Posts:
    52
    Hello,

    After updating to DOTween v1.0.800, Join method seems not to work right.

    Code (csharp):
    1. void Start()
    2. {
    3.     SpriteRenderer sprite = GetComponent<SpriteRenderer>();
    4.  
    5.     DOTween.Sequence()
    6.         .Append(transform.DOMoveX(1f, 1f))  // A
    7.         .Join(DOTween.ToAlpha(() => sprite.color, x => sprite.color = x, 1f, 1f))  // B
    8.         .Append(transform.DOMoveY(1f, 1f))  // C
    9.         .Join(DOTween.ToAlpha(() => sprite.color, x => sprite.color = x, 0f, 1f));  // D
    10. }
    I need to play C and D at the same time and I was able to do it in v1.0.750, however A , B and D play together now.

    How do I play C and D at the same time in the latest version?

    Thanks!
     
    Last edited: Jul 20, 2015
  20. hollywoodcolor

    hollywoodcolor

    Joined:
    Jul 12, 2014
    Posts:
    35
    How do I change the size of a UI panel with DOTween that has ( left right top bottom) in the rect transform?????
     
  21. franktinsley

    franktinsley

    Joined:
    Jul 1, 2010
    Posts:
    130
    Is DOTween Pro's path editor and tweening compatible with Unity's new UI so that it can actually animate inside canvas space? Meaning, create and edit a path that is child of a RectTransform in order to tween another RectTransform's position along said path. All I can find is examples of paths in world space instead of canvas space.
     
  22. FlipJam

    FlipJam

    Joined:
    Jun 3, 2014
    Posts:
    9
    This works great. I want use the current speed to send to a character Animator for animation blending. How can I find the current speed on a non-linear ease?
     
  23. StandAloneC

    StandAloneC

    Joined:
    Oct 21, 2013
    Posts:
    4
    Is there any better ways to SetActive the gameObject after Complete the tween rather than call a function which is SetActive only from OnComplete(SetActiveFunction)
     
  24. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Hi,
    Today i noted that you have a paid version on the store. As i promised last autumn, purchased it right after i saw it :)
     
  25. GordonWedge

    GordonWedge

    Joined:
    Jul 6, 2013
    Posts:
    23
    Hi, i've this problem.
    In my scene there is a sprite (a spider) that fall from top on a web with an animation, next i will start a dopath-tween from a trigger on the last frame of animation that launch a function (walk) from the script attached to the sprite.
    here is the script:

    Code (CSharp):
    1. public class spiderScript : MonoBehaviour {
    2.    Vector3[] waypoints = new[] { new Vector3(-1.4277f,-0.3371007f,0f), new Vector3(-0.08050418f,0.1498377f,0f) };
    3.  
    4.    void Start() {
    5.       DOTween.Init();
    6.    }
    7.  
    8.    void walk() {
    9.       Debug.Log ("begin walking");
    10.  
    11.       transform.DOPath(waypoints, 4, PathType.Linear, PathMode.Full3D, 10, null)
    12.          .SetDelay(0.3f)
    13.             .SetEase(Ease.Linear)
    14.             .SetAutoKill(true)
    15.             .OnComplete(endFunction);
    16.    }
    17.  
    18.    void endFunction() {
    19.       Debug.Log ("finish walk");
    20.    }
    21. }
    22.  
    i can see in console both message, start and end walking, and in runtime i can see the waypoints, but the spider never moves.
    If i attach same script on another sprite, and put the doPath commands in the start function, it works flawless.
    Where is my error?

    thanks
     
  26. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    Can you use DOTween to tween to properties in the same Tweener, as was possible in HOTween?

    In HOTween you could do HOTween.To().Prop().Prop()

    ... but in DOTween you can't do DOTween.To().To(), right?
     
  27. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Using DTPro I'm tweening a ugui element and it works fine on desktop but once I run the game on mobile the tween doesn't work or it completely overshoots the screen. Any reason why this might happen? My canvas is set to scale.
     
  28. woshihuo12

    woshihuo12

    Joined:
    Jul 18, 2014
    Posts:
    36
    i notice the dotween has "DOVirtual.DelayedCall(float delay, TweenCallback callback, bool ignoreTimeScale = true)"
    this is a very useful function..
    but my project now use Hotween..
    so Hotween has some kind function like this??????
    Very thanks..
     
  29. meapps

    meapps

    Joined:
    May 21, 2013
    Posts:
    167
    Give an example an i use it myself in my game alot and no issue on mobile.
     
  30. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    I'm having the same problem as Gigachu. I tried the following:

    Code (csharp):
    1. Vector2 moveRight_v2 = new Vector2( 200.0f, 0.0f );
    2. float rmbFadeDuration = 0.6f;
    3.  
    4. mySequence.AppendInterval( 0.5f );
    5. mySequence.Append( rightMouseButton.rectTransform.DOAnchorPos(moveRight_v2, rmbFadeDuration, false );
    6. mySequence.Join( rightMouseButton.DOFade( 0.0f, rmbFadeDuration, false );
    In this case, the Join tween couples with the AppendInterval delay. The DoAnchorPos occurs afterwards in the sequence.
     
  31. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Once again (this is very shameful) I apologize for answering so late. Unity's messaging system is working randomly for me, but I'll try to just come check in the future even if I don't get no mail.

    @GoesTo11 Sorry but no. Path scaling won't work (made a test to be sure of that, but nothing).

    @catbandit That is definitely the way to go, considering you will want to repeat them many times as I suppose. About connecting to the OnComplete event via script, you can get the list of all tweens created from all DOTweenAnimations and then use the OnComplete method on the second one:
    Code (csharp):
    1. myDOTweenAnimation.GetTweens()[1].OnComplete(MyCallback);
    @zhuchun Work on Chronos was postponed for a while (as I set my new machine), but I'm very interested it and I'm quite positive I should be able to make it work. How did the festival go? Good luck! :)

    @SidarVasco Are you using the latest Pro version? Consider that, when tweening the position of a UGUI object, its anchoredPosition is the property involved (because moving the transform.position of a UGUI element is overkill).

    @jprocha101 You can call DORestart even the first time. And about avoiding the reset, add a DOTweenManager component to the gameObject, and choose the "Add Manager" button on DOTweenAnimation's inspector, and choose the "Pooling System" preset.

    @Maeslezo Mhmm this is weird, I can't see any apparent mistake in your code. Could you send me a sample project that replicates this issue, so I can check it out?

    @Gigachu Ouch, sounds like a bug! Gonna investigate tomorrow morning.

    @hollywoodcolor If you want to change the sizeDelta of the RectTransform, you can do this:
    Code (csharp):
    1. DOTween.To(()=>myRectTransform.sizeDelta, x=>myRectTransform.sizeDelta = x, newValue, duration);
    If instead you just want to scale it, you can do this:
    Code (csharp):
    1. DOTween.To(()=>myRectTransform.localScale, x=>myRectTransform.localScale= x, newValue, duration);
    @franktinsley Sorry but no, at this moment the path system doesn't work with the UI elements. Or actually it works, but uses pure Transforms instead of RectTransforms, which is not recommended.

    @FlipJam Sorry, but I didn't understand the question. Could you explain me better?

    @StandAloneC Instead of creating a function to set the gameObject active, you could use an inline lambda:
    Code (csharp):
    1. myTween.OnComplete(()=>myGameObject.SetActive(true));
    @VeTaL Thank youuuuu! ^_^

    @GordonWedge Uhm, I can't see any mistake in your code, so that should totally work. Can you replicate that in a sample project and send it to me so I can check it out?

    @Bradamante Nope, you can't tween two properties with the same tween. But in exchange each DOTween's tween is so much more efficient (and lightweight) than HOTween's ;)

    @SidarVasco I suppose it might be related to your previous question, and to the fact that on mobile the resolution is different. Did you get the latest version from the private online repo? That fixes an issue that was present in older versions with UGUI elements.

    @woshihuo12 Hi! Sorry but no: that's a function new to DOTween.

    @solar_blitz More proof that this must be a bug I somehow created in the last versions. Apologies for this, hope to fix it for tomorrow.
     
    StandAloneC likes this.
  32. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I'd have to ask the invoice from my employer. I still have no access to the private online repo.

    But there are times that it works fine and then there are times it does not. I can't tell if it's my setup or Dotween. In the editor it works fine regardless of resolution.
     
    Last edited: Jul 29, 2015
  33. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    Hm. My problem is that in HOTween you could do:

    Code (csharp):
    1. HOTween.To( tf, mc.jumpScaleDur, newTweenParms()
    2.  .Id( string.Format( "TweenShip{0}", dc.id ) )
    3.  .Prop("localScale", JUMP_SCALE )
    4.  .Prop("position", posEnd)
    5.  .Loops(1, LoopType.Yoyo)
    6.  .Ease(EaseType.Linear)
    7.  .OnComplete ( OnDone )
    8.  );
    but in DOTween it is:

    Code (csharp):
    1. DOTween.To ( ()=> tf.position, x=> tf.position = x, posEnd, mc.jumpScaleDur )
    2.  .SetId ( string.Format ( "TweenShip{0}", dc.id ) )
    3.  .SetEase ( Ease.Linear );
    4.  
    5. DOTween.To ( ()=> tf.localScale, x=> tf.localScale = x, JUMP_SCALE, mc.jumpScaleDur )
    6.  .SetId ( string.Format ( "TweenShip{0}", dc.id ) )
    7.  .SetEase ( Ease.Linear )
    8.  .OnComplete ( OnDone );
    Notice the callback "OnDone". I guess this is purely academical and doesn't happen in reality ... Yet, at what point is the OnDone being called? Does the first .To() still run? One frame later?
     
  34. FlipJam

    FlipJam

    Joined:
    Jun 3, 2014
    Posts:
    9
    If I use SetSpeedBased to make the duration of a spatial tween become a speed indicator, is there a way obtain the current speed(magnitude) of the object during the non-linear tween?
     
  35. revolute

    revolute

    Joined:
    Jul 28, 2014
    Posts:
    50
    DOTween pro doesn't seem to set things properly for me.
    I have both 2d toolkit and DOTween pro in my unity asset account but I can't get the 2d toolkit shortcuts mentioned in http://dotween.demigiant.com/documentation.php#2dtoolkitShortcuts .
    Utility reports that it is set correctly, at least I can see my DOTween pro version being listed in it correctly (as v0.9.290).

    Did I miss something? Both of them are in my project, I did do dotween pro setup, so what am I missing?

    Oh, and furthermore, I have 2 computers, one MAC and one Windows, so that I can build both ios and android apps and debug them. However, excluding my first installment of DOTween pro in windows pc, I can't get it to run on mac. Maybe it is other problem, but I cant get it to work.
     
  36. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    Hello @Izitmee !
    Could you describe me how to correctly detect which of sequences are playing right now to kill them, cause if I just call :
    Sequence.Kill(); and sequence is not created and playing right now DOTWEEN kills random playing sequence.

    I was tried:
    Code (CSharp):
    1.   bool IsPlaying= Sequence.IsPlaying();
    2.         if (IsPlaying)
    3.         {
    4.             Sequence.Kill();
    5.         }
    But recieves that:
    NullReferenceException: Object reference not set to an instance of an object for first line

    Thanks in Advance
     
    Last edited: Jul 30, 2015
  37. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @solar_blitz @Gigachu This attached version fixes the Join issue. Please try it out and let me know: everything works here but I'd like to be sure with additional tests.

    @Bradamante True, and in that case OnComplete might be called before the first .To has run. That's because tweens are reorganized sometimes to store them more efficiently, so when more than one ends at the same time, the OnComplete is fired based on which comes first in the stored tween array, not based on the order of creation. If you want to be sure OnComplete is called after both have ended, you should add them to a Sequence in this case.

    @FlipJam With non-linear eases there is no built-in method to return the magnitude. You would have to implement it yourself by using a tween's OnUpdate callback and checking the magnitude between the previous position and the newly set one.

    @revolute I suppose it must be related to the fact you probably imported 2D Toolkit AFTER running DOTween's setup the first time? Try reimporting the full DOTween Pro package in your project and re-running the setup (from Tools > DOTween Utility Panel): that way the 2D Toolkit shortcuts should be correctly added.
    About your Mac issue instead, what is happening exactly? Are you getting some errors? Something else?

    @Rustamovich To know if a Sequence is playing, you can use IsPlaying. But that said, calling Kill on an empty/not-playing one should be correctly managed. I tried to replicate your issue but everything works correctly here. Can you send me a sample project that replicates it to check it out?
     

    Attached Files:

  38. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    @Izitmee It would be hard to extract this exact part from project.
    I was tryied with isPlaying too, but got the same error
    Code (CSharp):
    1. bool IsPlaying= Sequence.IsPlaying();
    2.         if (IsPlaying)
    3.         {
    4.             Sequence.Kill();
    5.         }
    6.  
    NullReferenceException: Object reference not set to an instance of an object for first line


    UPDATED: I Use Autokill and I didint recycle tweens
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Rustamovich I'm trying your same setup but am encountering no issues. Can you download the latest DOTween version (which I attached to my previous post) and see if it still happens with that one? Maybe you're encountering an old bug.
     
  40. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    @Izitmee I've updated to 1.0.805, it is sad to say but it still kills randomly random sequence if killing sequence is not exists.
    Am I Call Kill right?
    Code (CSharp):
    1. SequenceName.Kill();
    That is last bugs in my project, didnt solve them for so many time. Feel real sad
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Rustamovich I am so very puzzled. Could you write me the full stack of the log message you get when the NullReferenceException happens? That should report also the lines involved, and I hope it might help me replicate this issue.
     
  42. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    @Izitmee Maybe it is because I disable gameobject right after kill command without waiting for kill.?

    UPDATE: Ok, I think I'va found a workaround. If I turn on a recycleble tweens, but autokill is still on, so after first playing of sequence, on second playing thic line of code works:
    Code (CSharp):
    1. bool IsPlaying = SimpleEnemyMUpSeq1.IsPlaying();
    at first playing it is a :
    NullReferenceException: Object reference not set to an instance of an object
    DG.Tweening.TweenExtensions.IsPlaying (DG.Tweening.Tween t) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/TweenExtensions.cs:503)
    EnemySimpleScript+<DestroyEnemy1>c__Iterator1F.MoveNext () (at Assets/Scripts/EnemySimpleScript.cs:216)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    EnemySimpleScript:StopLevel() (at Assets/Scripts/EnemySimpleScript.cs:764)
    EventController:StopLevel() (at Assets/Scripts/EventController.cs:363)
    EventController:SetupLevelFunction(Int32) (at Assets/Scripts/EventController.cs:439)
    UnityEngine.EventSystems.EventSystem:Update()

    So how can I preplay all sequences before game is started?

    Now creation and playing of sequence working that way:
    Code (CSharp):
    1. void SetupMoveDownSequenceForType1 () {
    2.         SimpleEnemyMUpSeq1 = DOTween.Sequence();
    3.         SimpleEnemyMUpSeq1.Append (transform.DOLocalMove (new Vector3 (myPositionX - 1 , myPositionY + 1 , myPositionZ), 0.25f))
    4.                 .Insert (0.160f, transform.DOLocalMove (new Vector3 (myPositionX - 1, myPositionY - 1, myPositionZ), 0.25f))
    5.                 .Insert(0.01f,transform.DOLookAt (new Vector3 (myPositionX +1, myPositionY, myPositionZ), 0.2f, AxisConstraint.Y, Vector3.up))
    6.                 .SetEase (Ease.OutQuad);
    7.     }
    8.  
    9.     void MovingDownEnemyForType1 () {
    10.      
    11.         SetupMoveDownSequenceForType1 ();
    12.         SimpleEnemyMUpSeq1.PlayForward();
    13.  
    14.     }
    15. void StopMoving () {
    16.     bool IsPlaying = SimpleEnemyMUpSeq1.IsPlaying();
    17.  
    18.         if (IsPlaying)
    19.             {
    20.             SimpleEnemyMUpSeq1.Kill();
    21.        
    22.         }
    23. }
     
    Last edited: Jul 30, 2015
  43. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Nope, DOTween is not tied to gameObjects, so that can't have anything to do with it.
     
  44. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Rustamovich Ah, now I get it! The error is not generated by the Kill, but by IsPlaying. And that happens because your Sequence is not yet declared (meaning you're calling StopMoving before SetupMoveDownSequenceForType1 was called), so you're calling a method on a NULL object. Just change the IsPlaying line to this and it will work:
    Code (csharp):
    1. bool IsPlaying = (SimpleEnemyMUpSeq1 != null && SimpleEnemyMUpSeq1.IsPlaying());
     
    Rustamovich likes this.
  45. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    @Izitmee Wow! that's genius! Thank you so much!
     
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    You're welcome :)
     
  47. solar_blitz

    solar_blitz

    Joined:
    Jul 30, 2014
    Posts:
    19
    @Izitmee: The fix you made to Join is working! Thanks!
     
  48. revolute

    revolute

    Joined:
    Jul 28, 2014
    Posts:
    50
    @Izitmee MAC problem was a silly one. I forgot to update Unity and with update, it works well.

    For 2dTK, I recently added dotween pro. 2dTK was imported a few months ago and is up to date. I run weekly update checks, so I shouldn't be behind.
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @revolute Can you capture and post two screenshots of your Project panel? One that shows the content of the DOTween folder, and one that shows the content of the 2D Toolkit one?
     
  50. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    @Izitmee one more interesting question here.
    Can I somehow, if use Unity.Timescale/DOTween.TimeScale 1/1, when move Unity.TimeScale to 0 still have DotweenTimeScale at 1 only for one tween?