Lag issue when I add an enemy just in one scene

Godot Version

4.2

Question

i am making an hack an slash 2d game .
in just a one scene , when i instantiate an enemy and play it , has a very bad lagging.
this scene whith out enemy has no problem .
and other level’s and scenes , are working good . (even whith enemies)

how can i solve this lag ?

thanks for help

Without access to the project is hard to help because can be a lot of things. The tip i can give you is look the process and physics process times to have a idea from where the lag is coming.

thanks for reply

It seems like the longer we play, the more lag we get.

Your process time is absurdly high, seems like you’re something very expensive in some _process function.

what i should to do or check ?

i should check procces functions ?

Yes, is the start point.

I removed many process functions and wrote physics_process instead. and I used godot 4.3 instead of 4.2.

the game performans got better and lag decreased. but still here is a bit lag .
how to solve it too ?

As i said, without access to the project i can’t do more than guessing, you can look this for more tips about optimization process: General optimization tips — Godot Engine (stable) documentation in English

thanks