How not to render things that come out of the player screen?


Hi, if you talk about bullets or other things you won’t need anymore in your game as soon as they left the screen, you can use the ‘destroy when outside of the screen’ behavior.

1 Like

do not bullet objects such as blocks

You can apply the behavior to any object you like. If you have no use for the blocks anymore after they are out of the screen, this behavior might be the right thing to use.

sorry I was wrong that sprites are not rendered when the player does not see them and when they see they are rendered

For this you need to create and destroy the sprites outside the viewport through events. You can use the screen width and height as reference. Depending on the objects in your level this could be quite tedious and could also have some impact on the performance (if too many objects are created at once).

Did you check the recommendations in the wiki? How to debug poor game performance [GDevelop wiki] What I recall from previous threats is that you also should - if applicable - remove all unused objects from the resource list and that you should consider compressing your pngs (you can do that online).

Some clarity here:

Objects that are not on the screen are already not rendered graphically when they’re a certain distance away from the current camera area (I believe it is 10% of a screen length).

Animations stop, art isn’t rendered/is removed from memory/etc. Deleting the object won’t give much more performance from a graphic rendering perspective.

However, deleting an object WILL impact any events that you have that run every frame on that object, so that could help in those cases, but you normally won’t want to do that for level layouts.