Hello there, First I want to thank everyone who helped me last time :)
Now I have one more question, Script is:
using UnityEngine; using System.Collections;
public class GameController : MonoBehaviour {
///
/// The flasica.
///
public Transform flasica;
private float maxHigh;
public GameObject[] gameObjectSet;
void Start () {
Vector3 targetHigh = new Vector3 (-8.5f, -5.0f, 0.0f);
float flasicaHigh = flasica.renderer.bounds.extents.x;
maxHigh= targetHigh.x - flasicaHigh;
StartCoroutine (Spawn ());
}
IEnumerator Spawn () {
yield return new WaitForSeconds (2.0f);
while (true) {
Vector3 spawnPosition = new Vector3 (
Random.Range (-maxHigh, maxHigh),
transform.position.y,
0.0f
);
int whichItem = Random.Range (0, 5);
Quaternion spawnRotation = Quaternion.identity;
Instantiate ((gameObjectSet [whichItem]), spawnPosition, spawnRotation);
yield return new WaitForSeconds (Random.Range (1.0f,2.5f));
}
}
}
Now i need help, how can I create script so that clone objects will be showing up infront of player? I need clone to be Directly in front at a random distance.
↧