Why is my animation lagging on render?

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

The problem can be viewed here:

In the script, all I am doing is instancing the sword (Plunger) when the player hits a key.

Any ideas as to why this is happening?

:bust_in_silhouette: Reply From: Cire_arievilo1

go to the project settings click on run and activate the low processor mode maybe this can solve the problem.

Unfortunately that did not change the issue.

Meyerjc | 2022-11-04 07:21

:bust_in_silhouette: Reply From: godot_dev_

Look at your game’s frame rate. If it remains static (e.g., 60fps), then your code is incorrectly changing the speed of your animation. If the framerate drops, then the spawning of the sword is probably causing lag. I recommend preloading and instancing the sword if that ends up being the case and see if the game still lags

Frame rate seemed fine, but preloading and instancing the sword did the trick! Thanks!

Meyerjc | 2022-11-04 17:49