Godot Version
4.5.stable
Question
I’m doing a little bullet hell game, just for fun and I use VisibleOnScreenNotifier2D on each laser shot to properly free them; when they exit the screen.
One of the unit is a “flying saucer” that shoots around itself; one to three laser per (4) quadrant.
When I spawn a unit–outside the top screen limits–it goes straight down until it disappears. Each laser should be freed upon exiting the screen. The problem is, certain laser scenes do not get freed. They go on forever.
After debugging, I found that the saucer is the culprit. I thought it was because they are spawned outside the limit of the screen and start shooting right away, the lasers spawning in NE and NW quadrants would never trigger the VisibleOnScreenNotifier2D signals, but that’s not the entire reason. I use a print() statement when the laser enters the screen and for the buggy lasers, it is triggered as the others. But, it’s always those going further into the negative Y that are problematic. At least I haven’t seen anything showing a different behavior.
At this point I haven’t seen a laser spawned in the SW or SE quadrant not properly freed.
Anyone has seen anything like that before?
It is not a huge problem right now. After player’s death, the scene is freed and the lasers follow suit, but for now there isn’t much going on in the game and there’s no real level. I’m worried it might become an issue the longer a scene remains alive whereas I’ll end up with too many lasers off screen.