Animation stops when another game object is deleted

I’m working on a game right where a game objects has a factory that spawns objects. These objects handle their own animations using the go.animate functions.

These objects are only suppose to stay alive for 2 seconds then delete themselves using go.delete however, all other game objects that are the same instance from the factory stop animating once one is deleted.

I have reproduced this problem with a much simpler demo, the demo uses the same technique as my game. A factory spawns the logo game objects. The logo animates only the alpha of the sprite. And after 5 seconds it deletes itself. Then the other logos simple stop animating and then delete after 5 seconds.

The demo is in the zip as well as the source files in the source folder.

If you watch the game. At first everything works fine. The logos loop forever going from 1 to 0.2 in tint.w. However after sometime then all start to animate but then simple stop at 0.2.

My project.zip (2.3 MB)

1 Like

Yes, this an odd behavior indeed.
Unfortunately, I don’t have a very good workaround for you. Perhaps you could create your own pool of objects, and then instead activate/deactivate them when needed, via messages.

Thanks for the good example app!

That is no problem. I have a workaround right now, need to finish it, I will post it here just in case someone else wants to use it.

I did test a few more things and it seems that this animate bug only happens when animating the tint property. I tested this with position and euler. Both worked fine every time. Only animating tint causes this bug.

Also I have tried animating the “tint.w” with a number and also animating “tint” with a vector4. Both caused this bug.

1 Like