phanductrieu / itween

Automatically exported from code.google.com/p/itween
0 stars 0 forks source link

iTween.Stop() bug #114

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create twoo LoopTyped iTween.MoveTo
2. execute a iTween.Stop() to stop all then
3. Only one stops

What is the expected output? What do you see instead?
Expected all tweens stoped, but only one stops.

What version of the product are you using? On what operating system?
Version: 2.0.45, Unity 3.5.6f4, Windows 7 64 bits

Please provide any additional information below.

I resolve the problem counting the active tweens backwards:
6359        // for (int i = 0; i < tweens.Count; i++) { // actual code
6360        for (int i = tweens.Count-1; i >= 0; i--) { // my code

Original issue reported on code.google.com by oswaldo....@gmail.com on 10 Jan 2013 at 5:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have the same problem.  I assume it's because the tween gets removed from the 
Hashtable and so, when tweens.Count get re-evaluated each time around the for 
loop, the loop will ultimately exit prematurely.  

Original comment by stewmur...@gmail.com on 13 Mar 2013 at 8:42

GoogleCodeExporter commented 9 years ago
My iTween.Stop code for the version from 4/16/2013:

public static void Stop ()
{
    while (tweens.Count > 0) {
        Hashtable currentTween = (Hashtable)tweens [tweens.Count - 1];
        GameObject target = (GameObject)currentTween ["target"];
        Stop (target);
    }
}

I haven't done any testing to speak of other than for my specific case, but I'd 
be very surprised if this doesn't work for anything that the forward-iterating 
code did work for.

Original comment by jesdisci...@gmail.com on 31 Jul 2013 at 9:10

GoogleCodeExporter commented 9 years ago
Oh, I should also note that the backward-iterating for loop above is broken for 
GameObjects with multiple iTween components, as they will all be removed in the 
same iteration of the for loop.

Original comment by jesdisci...@gmail.com on 31 Jul 2013 at 9:14