Skip to content

Instantly share code, notes, and snippets.

@kou-yeung
Last active November 8, 2018 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kou-yeung/90aa40b02c6e62dc18b764689ce6742d to your computer and use it in GitHub Desktop.
Save kou-yeung/90aa40b02c6e62dc18b764689ce6742d to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Manager : MonoBehaviour
{
public GameObject prefab;
public float distance = 100; // ランダム生成の範囲(中心からの距離)
public float numOfObject = 10000; // 生成するオブジェクトの数
void Start()
{
for (int i = 0; i < numOfObject; i++)
{
var go = Instantiate(prefab);
go.transform.localPosition = Random.insideUnitSphere * distance; // 座標
go.transform.localRotation = Random.rotation; // 向き
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment