-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpawnTest.cs
40 lines (26 loc) · 810 Bytes
/
SpawnTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnTest : MonoBehaviour {
public Mesh mesh;
public Material material;
private Vector3[] positionBuffer = new Vector3[15000];
// Use this for initialization
void Start () {
GeneratePositions ();
}
private void GeneratePositions(){
for (int i = 0; i < 15000; i++)
{
positionBuffer [i] = new Vector3 (Random.Range (-100, 100), Random.Range (-100, 100), Random.Range (-100, 100));
}
}
// Update is called once per frame
void Update () {
for (int i = 0; i < 15000; i++) {
Graphics.DrawMesh (mesh, positionBuffer [i], Quaternion.identity, material, 0, null, 0, null, false, false);
//Graphics.DrawMeshInstancedIndirect(mesh, 0, material,
}
GeneratePositions ();
}
}