Callback ordering
« on: July 01, 2015, 07:26:16 PM »
The code below produces the following sequence: 2, 1
var seq = DOTween.Sequence();
seq.AppendCallback(() => Debug.Log(1));
seq.AppendCallback(() => Debug.Log(2));

The code below produces the following sequence: 1, 2
seq.AppendCallback(() => Debug.Log(1));
seq.AppendInterval(0.001f);
seq.AppendCallback(() => Debug.Log(2));

What is the correct way of appending callbacks and getting the correct sequence?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Callback ordering
« Reply #1 on: July 01, 2015, 08:27:15 PM »
Callbacks that happen at the same time may happen randomly due to the storage logic. If you want to append two callbacks at the same exact moment, I'd recommend using a single one and adding multiple functions to it:
Code: [Select]
seq.AppendCallback(() => {
   Debug.Log(1);
   Debug.Log(2);
});