Spawn outside camera view

Hi there, I am stuck with a spawning system I am currently working on, I want this system to NOT spawn inside the cameras view. As of now I am spawning within a box colliders bounds but want it to spawn only where the camera cannot see. As this is an infinite scroller i am spawning platforms at runtime (Pooling them not creating and destroying) so sometimes they spawn where the player can see, I only want to spawn outside of the players view.

Thanks

You can use Viewport coordinates to place your objects. In viewport coordinades, the bottom left of the camera view is 0,0 and the top right 1,1. So if you covert a coordinate outside this range to world coordinates, it will not be visible. Say your camera was sliding right and you wanted to spawn something just out of view you could find the spawn point by:

Vector3 v3Pos = Camera.main.ViewportToWorldPoint(new Vector3(1.1f, 0.5f, 10.0). 

The Z parameter is the distance in front of the camera. Your object being spawned has some width, so you will need to pick a value (like 1.1 or 1.2) to make sure it is not visible.