je crée un jeu en 2d et pour un level aléatoire j'ai fait ce script qui instancie un objet aleatoire a la premiere position mais j'aimerais savoir quel objet il a instancier pour pouvoir en mettre un autre qui aille bien voila le script :
Code : Tout sélectionner
using UnityEngine;
using System.Collections;
public class spawn : MonoBehaviour {
public GameObject[] tuyauhaut;
public GameObject[] tuyaugauche;
public GameObject[] tuyaudroite;
public Vector3 firstpos;
// Use this for initialization
void Start () {
int randomNumber = Random.Range (0, tuyauhaut.Length);
Instantiate (tuyauhaut[randomNumber], firstpos, transform.rotation);
}
// Update is called once per frame
void Update () {
}
}
Merci