*

keht

  • *
  • 10
    • View Profile
Troubles with sequences
« on: May 11, 2015, 11:24:24 PM »
Hello! I have some troubles with sequences.

First one:
        DOTween.Sequence()
            .SetId(123)
            .PrependInterval(3)
            .AppendCallback(() =>{Debug.Log("First callback!");})
            .PrependInterval(3)
            .AppendCallback(() =>{Debug.Log("Second callback!");});


Both callbacks will called at the same time. If I change AppenCallback to OnComplete, it does not works too. Is there any way to use multiply callbacks inside sequence?

Second one:
        DOTween.Sequence()
            .SetId(123)
            .PrependInterval(3)
            .OnComplete(() =>{Debug.Log("First callback!");})

        DOTween.Kill(123, true);


Callback does not called here. Why?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Troubles with sequences
« Reply #1 on: May 12, 2015, 02:27:53 AM »
Hello!

First one, you are using PrependInterval, which adds an interval at the beginning of a Sequence, instead of AppendInterval, which adds it after the current Sequence position. So you're actually setting both callbacks to be called after 3 seconds.

Second one, uhm... that is wrong instead. Are you using the latest version of DOTween (1.0.665)?

*

keht

  • *
  • 10
    • View Profile
Re: Troubles with sequences
« Reply #2 on: May 12, 2015, 10:14:56 AM »
Quote
First one, you are using PrependInterval, which adds an interval at the beginning of a Sequence, instead of AppendInterval
My bad. Sorry!

Quote
Are you using the latest version of DOTween (1.0.665)?
Yes.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Troubles with sequences
« Reply #3 on: May 12, 2015, 11:40:26 AM »
I tested the second issue and everything works here. But I'm on a more recent version that I plan to push today, where I fixed a Sequence bug that might be related to that. Find it attached in the meantime :)

*

keht

  • *
  • 10
    • View Profile
Re: Troubles with sequences
« Reply #4 on: May 12, 2015, 01:43:56 PM »
Thanks for sharing! I tried the new version and my case from the first post works fine.

But this code does not works as expected:
Code: [Select]
        DOTween.Sequence()
            .SetId(123)
            .AppendInterval(3)
            .AppendCallback(() => { Debug.Log("First callback!"); })
            .AppendInterval(3)
            .AppendCallback(() => { Debug.Log("Second callback!"); })
            .OnComplete(() => { Debug.Log("Third callback!"); })
            ;

        DOTween.Kill(123, true);

After execution I see only "Third callback!" log entry.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Troubles with sequences
« Reply #5 on: May 12, 2015, 01:46:49 PM »
In the last example, that is the correct behaviour. If you force-complete a tween, only an OnComplete callback will fire, and nothing else. Because you're not "scrubbing fast" towards the end, but just jumping to the end, so every other callback won't be taken into consideration.

*

keht

  • *
  • 10
    • View Profile
Re: Troubles with sequences
« Reply #6 on: May 12, 2015, 08:37:46 PM »
I Am understand the flow finally. Thanks for the explanations!

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Troubles with sequences
« Reply #7 on: May 12, 2015, 09:00:15 PM »
You're welcome :)