我喜欢在3D点阵列上绘制具有特定小半径的小球体或点。我在Prefabs中使用了Sphere GameObject,并在需要绘制时实例化它。由于我绘制了很多,系统无法处理。如何在Unity中的3D点绘制球体或点?
我需要绘制的方法是
for (int i = 1; i < 200; i++)
{
for (int j = 0; j < i; j++)
{
Instantiate(dot, start[j], new Quaternion(0,0,0,0));
GameObject.Destroy(GameObject.FindWithTag("dot"), 0.01f);
}
}
因为它是从1到200变化,因此系统不能处理它,甚至我消灭他们。
所以我改变
for (int i = 1; i < 200; i++)
{
for (int j = 0; j < i; j++)
{
//Here devicePlots.Count is same as i
Mesh mesh = new Mesh();
mesh.vertices = devicePlots.ToArray();
Color[] colors = new Color[devicePlots.Count];
int[] indices = new int[devicePlots.Count];
for (int j = 0; j < devicePlots.Count; j++)
{
indices[j] = j;
colors[j] = Color.red;
}
}
}
但没有出来。
我的查询是 (1)如果使用Instantiating GameObject的第一种方法是正确的做法,那么该如何让系统可以处理。 (2)如果第二种方法合适,为什么我看不到点? 我是Unity新手。谢谢。
当你说系统无法处理它时,你是什么意思?怎么了? – Programmer
程序变得非常慢,鼠标不能移动等。 – batuman