- Home /
2D runner, need a help
I have a script for spawning platforms:
using UnityEngine;
using System.Collections;
public class SpawnScript : MonoBehaviour {
public GameObject[] obj;
public float spawnMin = 1f;
public float spawnMax = 2f;
// Use this for initialization
void Start ()
{
Spawn ();
}
void Spawn ()
{
Instantiate (obj [Random.Range (0, obj.GetLength (0))], transform.position, Quaternion.identity);
Invoke ("Spawn", Random.Range (spawnMin, spawnMax));
}
}
But my platforms spawning or too close to each other, or on each other :( What I need to do that platforms will spawn normally? Not too close to each other and not on each other.
Comment