- Home /
SetTriangleStrip to SetTriangles
I am using Bunny83's code as a replacement to Unity's LineRenderer: Link
In this code, the method SetTriangleStrip was labeled as obsolete, but still functioned in Unity4. However, I just downloaded Unity5 and this is not the case anymore. I replaced SetTriangleStrip with SetTriangles, but now I get the warning that triangles must be multiples of 3. Could someone help me update this code? Thank you!
Answer by Zayin · Mar 04, 2015 at 09:25 PM
I found a solution that works. I just had to think how strips were converted to triangles. Here's what I changed in the end:
m_Indices = new int[(m_Points.Count*2-2)*3];
int j = 0;
for (int i = 0; i < m_Points.Count*2-3; i+=2, j++)
{
m_Indices[i*3] = j*2;
m_Indices[i*3+1] = j*2+1;
m_Indices[i*3+2] = j*2+2;
m_Indices[i*3+3] = j*2+1;
m_Indices[i*3+4] = j*2+3;
m_Indices[i*3+5] = j*2+2;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613185031im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Heap problem when creating a large number of objects. 1 Answer
Changing two different objects renderer colour 1 Answer
Mesh renderer properties 1 Answer
Pixel-art styled line generation. 1 Answer