Hi guys
I am creating one game where my camera is still and some objects pass from front of the camera from right to left.
I am trying to display the GUI menu after last object left the screen. But don’t know how to do that.
This is my game master script where I am instantiating prefabs
#pragma strict
var respawn1:GameObject;
var randomcars:int;
var i:int;
function Start () {
randomcars = Random.Range(10,20);
for (var i : int = 10;i < randomcars; i++) {
Instantiate (respawn1, Vector3(i * 5, 0, 0), Quaternion.identity);
}
}
function Update (){
}
2nd is my obejct script , just to move object from right to left of screen
#pragma strict
var moveSpeed= -5;
function Start () {
}
function Update () {
transform.position.x += moveSpeed * Time.deltaTime;
if (transform.position.x <-12){
Destroy(gameObject);
}
}