Find random point just off camera

I’m looking to create a script that will efficiently find a random point that is just off camera.

The goal is to use this to spawn NPC units just off camera so that as the camera moves I can despawn and respawn units making the space look relatively well occupied with only a handful of NPCs

Any suggestions on how I could do this in a performant way?

Thanks!

Yes, but you need to take care of the world size of the NPC you’re spawning.
Maybe you could (just an idea) :
-take the front vector in world space (ask the Camera transform).
-rotate it around up of a little bit more than half the camera FOV.
-pick a random distance from the player.
-Compute your spawning position (poscamera + spawning direction (in local camera space) * random distance).