Tween, delay when used in custom behavior

Tween, delay when used in custom behavior

I use the Tween behavior to animate the button. Desired result:
button_result

To make it more useable, I’ve created a separate behavior in the project that does this animation. But when you restart the current scene (the Change to scene CurrentSceneName() functions), there is a delay in the behavior.

In the demo project, I created 2 options for describing this animation (for each object its own version):

  1. In scene events:

  2. In a separate behavior:
    onCreated:


    doStepPreEvents:

    onDestroy:

    onActivate:

    onDeActivate:

When restarted, the animation from the behavior starts running later. Result:
bad_result

At the same time, if you switch to another scene and return, then everything works correctly.

Project example: custom_behaviors_delay.zip

Can you please tell me what is the problem?

I’ve tested and I think is because the tweens share the same name so when the custom behavior one is called doesn’t start because there is another tween already running with the same name.
You can try to add different names to each tween on each different object.

I tried. In the onCreated event, I added a timestamp to the “animation name” property. Didn’t help. And as far as I understand, this should not interfere, because it refers to a specific object, that is, another scope.
Then why does it work correctly on first launch (or transition from another scene)?
@UlisesFreitas Did it work for you when you change your name?

I’m checking now stay tuned.

Well this is something weird if you add the object into the editor and change the scene it has a delay but if you create the object from events works fine.
Look


If so, it looks like a bug. Do you agree?

I ask the moderators to move this topic to the “Bugs reports” section.

@arthuro555 Thanks. I just noticed that I could do it myself. Excuse for troubling.