Empty GameObject in Camera View

Hello,

I have multiple empty gameobjects scattered around the game terrain, which act as spawn points for my enemy. and my camera follows the player.

after looking on the forums, i got renderer.isVisible option, but i guess this is only useful if a renderer is attached to the object, but whereas i have empty gameObjects.

So, how do i know that which spawn points are within my camera view and which are not, as i want to spawn enemies from points which are not in camera view.

Any Suggestions.

Camera.main.WorldToViewportPoint(Vector3 position) check the x,y values if its beyond 0 and 1 it is not in view.

hey,

Thanks For the help…worked like a charm :slight_smile:

1 Like

No problem, glad I could help.