MoPaMo
MoPaMo

Reputation: 684

Phaser render only what's in the camera

I'm building a large open world game with Phaser

My problem: Because of the many components, which all have to be rendered, the world gets very slow and eventually even stops working.

So I was thinking if you could just stop rendering them?

How can you achieve this and is there maybe an inbuilt method for this?

Thanks in advice

Upvotes: 1

Views: 310

Answers (1)

Anton
Anton

Reputation: 878

I think they are actually not rendering when out of camera scope, but they are 'updating' (phaser calls update for every game object added to launched scene) on every frame.
You can preven calling .update() of game object by setActive method: https://newdocs.phaser.io/docs/3.55.2/focus/Phaser.GameObjects.GameObject-setActive

Upvotes: 1

Related Questions