Опубликовано

в разделе

VR и AR, 28.12.22

Простейший генератор объектов из префабов

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = System.Random;

public class CoinSpawner : MonoBehaviour
{
    public GameObject coinPrefab;
    public int coinCount = 1000;
    
    // Start is called before the first frame update
    void Start()
    {
        Random rnd = new Random();
        for (int i = 0; i < coinCount; i++)
        {
            GameObject newCoin = Instantiate(coinPrefab, transform.position + new Vector3(rnd.Next(0, 20), 0, rnd.Next(0, 30)), Quaternion.identity);
        }
    }
}

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *