Hey, i have little experience, i’m using C#.
I am trying to spawn a series of Quads (backgrounds) in to a game.
I want the first background to spawn when the game is started.
Then after X seconds i want the second background to spawn.
Then after Y seconds ( from time = 0 )i want the third background to spawn.
I want each background to destroy the previous but haven’t attempted this as i cant get then to spawn.
i can get background one to spawn but neither of the other two.
Any help will be greatly appreciated.
Here is the code i have so far:
using UnityEngine;
using System.Collections;
public class BackGround : MonoBehaviour {
public GameObject background_one;
public GameObject background_two;
public GameObject background_three;
float timer = 0f;
// Use this for initialization
void Start () {
Instantiate(background_one, new Vector3(0,0,0), Quaternion.identity);
}
// Update is called once per frame
void update () {
timer += Time.deltaTime;
if (timer >= 2)
{
Instantiate(background_two, new Vector3(0, 0, 0), Quaternion.identity);
}
if (timer >= 4)
{
Instantiate(background_three, new Vector3(0, 0, 0), Quaternion.identity);
}
}
}