Godot Version
4.5
Question
I’m building a simple game containing an agent that destroys objects on the map. I have around 30 boxes with simple collisions (Node3D with child StaticBody3D/CollisionShape3D:Box), agent (CharacterBody3D/CollisionShape3D: capsule), ground (StaticBody3D/CollisionShape3D: Box). Agent uses different weapons (physics-based detection): projectiles, explosions, and rays. Each object has a child POI with tags, HP, etc - the agent’s logic revolves around POIs.
I encountered strange behavior:
- Total Objects Drawn is increasing constantly, with fewer and fewer objects visible on the scene
- Physics Process takes more and more time, from 3ms at the beginning, when the scene is most complicated, to over 100ms at the end, when all boxes are destroyed
Monitors show: steady Nodes, Objects, and Resources count, no Orphan Nodes, steady (decreasing) Total Draw Calls. The remote scene shows everything as expected - new projectiles or explosions created and disappearing, nothing strange. Profiler shows that the physics tick is longer and longer, but no calls are associated with this (must be something internal). I tried using physics on the main and separate threads. I even wrote my own profiler to check all the code inside _physics_process and everywhere else - no luck. I don’t create or clone materials or meshes; everything is super simple. I count all the objects by myself and cannot detect any leaks - I suspect a strange leak with something invisible with physics is constantly being added to the scene.
I’ll appreciate any ideas on how to tackle this problem, thanks!