This script is attatched to a pick up that i want to destroy and respawn after random time. It doesnt respawn. Anybody know why?
using UnityEngine;
using System.Collections;
public class PickUpRespawn : MonoBehaviour
{
private int rotateSpeed;
private float nextSpawnTime;
public GameObject Armour;
void OnTriggerEnter (Collider other)
{
if (other.tag == "Player")
{
nextSpawnTime = Random.Range (0, 10);
Destroy (Armour);
Invoke ("respawn", nextSpawnTime);
}
}
void respawn()
{
Instantiate (Armour, transform.position, Quaternion.identity);
},