-
-
Save kou-yeung/90aa40b02c6e62dc18b764689ce6742d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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