using UnityEngine;
using System.Collections;

public class RespawnObject : MonoBehaviour {

	public float respawnTime;
	public GameObject item;
	private float time;

	private GameObject inst;

	// Use this for initialization
	void Start () {
		time = 0;
		inst = GameObject.Instantiate (item, transform.position, item.transform.rotation) as GameObject;
	}
	
	// Update is called once per frame
	void Update () {
		if (inst == null) {
			time += Time.deltaTime;
			if (time >= respawnTime) {
				time = 0;
				inst = GameObject.Instantiate (item, transform.position, item.transform.rotation) as GameObject;
			}
		}
	}
}
