I have this script. problem is Gameobject only spawns when I use InvokeRepeating, but i need to use Invoke, to Invoke at a set random time.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class SpawnScript : MonoBehaviour {
public float SpawnMin = 1f;
public float SpawnMax = 2f;
void Start() {
Invoke ("Spawn", Random.Range(SpawnMin, SpawnMax));
}
void Spawn()
{
GameObject obj = ObjectPoolerScript.current.GetPooledObject ();
if (obj == null) return;
//sets spawn position/rotation
obj.transform.position = transform.position;
obj.transform.rotation = transform.rotation;
//makes object active
obj.SetActive (true);
SetActiveFalseScript.stopmovement = false;
}
}