Momentary Flicker on Scene Instance

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By KirkwallDay

I have a scene that is instanced when the character wants to swing a sword. Right now it’s just a prototype green color-rect and a collision area, both hooked up to a animation player under a Node2D. I setup the animation player to move the collision area and the color rect “Sword” in response to the direction the player is swinging from.

This works, however the scene first appears as it was saved in the editor for a 10th of a second before the animation plays as normal. The rect rotating along the side that the player swings from.

I managed to find a fix. I can turn the visibility on the rect off and then do a yield ‘idle_frame’ to create a pause before turning it on. I guess my question now is: Is that the proper way to do it, or am I missing something?

Is the animation immediately playing when you instance the scene?

Ideally scenes with animations must be saved with all of their animation rewinded to default pose, if not they might not start in the correct state, so that’s another thing to check.

Zylann | 2019-03-08 18:50

:bust_in_silhouette: Reply From: slasktotten

I have run into a similar issue. Did you manage to figure out a less hacky fix?