Animation freeze issue during object interaction

I am having a bit of problem with changing the object animation. I have this interaction/animation working in my earlier build, but now it is behaving weirdly. Here’s the snapshot of the same. Action/events in screen shot marked 1 is giving me problem, while animation in screenshot marked 2 is working fine.

Some problems:

  1. Not sure what is happening to animation “Open_Full”. I tried adding “Wait for x seconds” after the animation is complete to delay/see the state for a while, but that only introduced delay without changing the animation.
  2. Chest animation is not setting to “Open_Empty”.
  3. The Repat events are triggering multiple times, while it is marked as “Trigger once”. Probably because Chest animation is not setting.
  4. I tried deleting the "“Change scene variable” events, but no improvement in the output.
  5. I tried breaking the actions with “Wait” action, but that wasn’t helpful.
  6. I tried removing the “While… Repeat” and clubbed all three conditions in one. Didn’t work either.
  7. Sometimes the scene freezes the moment player interacts with the chest; sometimes, it changes the score and coin count, but keeps the chest animation to “Closed” and allow multiple interactions with the chest.

My goal is to have Chest animation in “Closed” state switch to “Open_Full” and then deactivate player control for few seconds, and then change the Chest animation to “Open_Empty” and ignore any further player interaction with it. (Animation state flow: Closed > Open_Full > Open_Empty). To debug the issue, I tried this:

which freezes the scene. While the below two changes (with or without “Trigger Once”) opens and shuts the chest.

There are multiple instances of chest in the scene and all three of its animation states have just a single frame each. Not sure if having a single frame for each state is the cause of the problem, but then chest object in screenshot 2 is also having a single screenshot for each animation and it is working fine. :frowning:

While I can’t dig into this fully for you, as a heads up: While statements, by design, will stop a frame from processing until they are done.
The “repeat” section of the While Statement event is not compatible with “trigger once” for that reason.

That said, there is no reason to use a while event for anything animation related, and I don’t understand why you’re using it in the above.

Nothing about your event condition or event require a while statement event.

I’d recommend moving your entire event out of the while statement event into a normal event, and see if that at least works for stopping the freeze.

I tried that without a while statement with or without trigger once. Please see screenshot 3 and 4.

I am unable to understand if loop is a problem, how the events worked perfectly well in screenshot 2 which also uses while loop with trigger once and why the chest state is not setting to “Open_Full” without loop and with just two simple conditions?