Код: Выделить всё
using UnityEngine;
public class PropsRandomizer : MonoBehaviour
{
public List propSpawnPoints;
public List propPrefabs;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
SpawnProps();
}
// Update is called once per frame
void Update()
{
}
void SpawnProps()
{
foreach (GameObject sp in propSpawnPoints)
{
int rand = Random.Range(0, propPrefabs.Count);
Instantiate(propPrefabs[rand], sp.transform.position, Quaternion.identity);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... -for-unity
Мобильная версия