Search Unity

Spawning game objects off screen

Discussion in 'Scripting' started by Red_5, May 21, 2009.

  1. Red_5

    Red_5

    Joined:
    Oct 16, 2008
    Posts:
    17
    Hello all,

    I'm trying to figure out how I could spawn a game object off screen as the camera moves along the X axis similar to arcade games. As the player progresses forward objects spawn off screen.

    I've been looking at instantiating the gameoObject but i'm not entirely sure how to go about it.

    Thanks for any help you can provide.
     
  2. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Use Instantiate and provide a location that's outside of the camera's view frustum. You can determine that sort of position by using the camera's position and then padding some vector distance to the left/right of the camera. Am I making sense? :)