Code Monkey home page Code Monkey logo

Comments (6)

oneclickdev avatar oneclickdev commented on July 19, 2024

any progress/workaround/suggestions?

from dotween.

samdze avatar samdze commented on July 19, 2024

Sequences made entirely of callbacks also execute in wrong order.

What steps will reproduce the problem?

Sequence seq = DOTween.Sequence();
seq.SetAutoKill(false);
seq.AppendCallback(delegate { Debug.Log("1"); });
seq.AppendCallback(delegate { Debug.Log("2"); });
seq.AppendCallback(delegate { Debug.Log("3"); });
seq.AppendCallback(delegate { Debug.Log("4"); });
seq.AppendCallback(delegate { Debug.Log("5"); });

What is the expected output? What do you see instead?
Expected:
1
2
3
4
5
Actual result:
4
5
3
1
2
What version of the product are you using?
DOTween v1.1.340 [Compatibility build]

The sequence runs if played with PlayForward, however it does not when the sequence is completed and PlayBackwards is called.

This issue prevents me from using sequences made only of callbacks as the documentation states. And it would also be useful to be able to execute them backwards.

from dotween.

Demigiant avatar Demigiant commented on July 19, 2024

Hi,

Time is truly important (this is a tween engine after all :P), so things/callbacks that happen at the same exact time are fired randomly, because the only order is time.

If you want something to be called after something else, just add a slight timegap between the two (even if only 0.0001), so you can play it backwards.

If you want things to happen at the same time but with your desired order, use a single callback:

seq.AppendCallback(()=>{
   Debug.Log("1");
   Debug.Log("2");
   Debug.Log("3");
});

from dotween.

davidejones88 avatar davidejones88 commented on July 19, 2024

Hello @Demigiant !
I am using DoTween 1.2.632 and I have noticed that code such as

        Sequence seq = DOTween.Sequence();
        seq.SetAutoKill(false);
        seq.AppendCallback(delegate { Debug.Log("1"); });
        seq.AppendCallback(delegate { Debug.Log("2"); });
        seq.AppendCallback(delegate { Debug.Log("3"); });
        seq.AppendCallback(delegate { Debug.Log("4"); });
        seq.AppendCallback(delegate { Debug.Log("5"); });

now produces always the same output: 1 2 3 4 5 (at least in the Editor) reliably. Did something change in the implementation since 2016?

Also, it is not clear to me what Adds the given callback to the end of the Sequence. means in the docs for the AppendCallack method because it seems that the code in the AppendCallack gets triggered in the sequence order, not at the end of the sequence. Could you please clarify?

Thanks for your help!

from dotween.

Demigiant avatar Demigiant commented on July 19, 2024

Hey!

Yes, I upgraded the system so that even callbacks are now called in the order you added them, even if they're at the same time position :) And about AppendCallback, I just added a clarification to the docs: "Adds the given callback to the end of the Sequence (meaning the current total duration of the Sequence)". Does that sound good?

from dotween.

davidejones88 avatar davidejones88 commented on July 19, 2024

@Demigiant
Your comment and the new phrasing in the docs solve every doubt I had.
Thank you for your update and your incredible library. Cheers!

from dotween.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.