I’m trying to make a gameObject appear in my scene every 2 seconds but it is appearing every frame.
How can I fix this problem?
using UnityEngine;
using System.Collections;
public class UFOspawn : MonoBehaviour {
public int ufoSpeed;
public float Timer = 2;
public GameObject ufo;
GameObject ufoClone;
void Start ()
{
}
void Update ()
{
Timer -= 1 * Time.deltaTime;
if (Timer <= 0);
ufoClone = Instantiate (ufo,(new Vector3 ((Random.Range (-9, 9)), 5, 0)), transform.rotation ) as GameObject;
Timer = 2;}
}
}