Loading scene chunks when they need to be displayed

Hi,
I want to build a side-scrolling (jump and run) game that has an infinite level. Therefore I have to split the level up into smaller chunks.
My problem is to find out when a new chunk has to be loaded.

Imagine the following situation (the game actually is in 3D, not 2D):

Game situation

The yellow block can be deleted, because it is no longer visible. I’m using OnBecameInvisible to find out, if the block moved out of the camera’s view.

But how do I find out when to load the next (blue) block? I tried playing around with the value of the X axis of the second to last block, but hardcoding this value will mess up the game when the aspect ratio changes.

Any ideas? :slight_smile:

maybe when OnBecameInvisble is deleting the old one, it can generate a new one at the same time.