using UnityEngine; using System.Collections; public class RandomPlatforms : MonoBehaviour { GameObject platform; GameObject enemy; int numPlatforms, ranIndex, numEnemies; double[] heights = {-1.39, 0.9, 3.11, 5.32, 7.57 }; // Use this for initialization void Start () { platform = GameObject.Find("platform"); numPlatforms = Random.Range(30, 60); enemy = GameObject.Find("Enemy"); numEnemies = Random.Range(2, 8); for(int i = 0; i < numPlatforms; i++) { ranIndex = Random.Range(0, 5); GameObject platformapus = Instantiate(platform, new Vector3( Random.Range(-20, 124), (float)heights[ranIndex], 10), Quaternion.identity) as GameObject; } for (int i = 0; i < numEnemies; i++) { ranIndex = Random.Range(0, 5); GameObject enenemenenies = Instantiate(enemy, new Vector2(Random.Range(-10, 124), (float)heights[ranIndex]), Quaternion.identity) as GameObject; } } }