我喜歡在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