See Unity's answers to a similar question.
Alternatively :
float theta_scale = 0.1; // Circle resolution LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Particles/Additive")); lineRenderer.SetColors(c1, c2); lineRenderer.SetWidth(0.2F, 0.2F); lineRenderer.SetVertexCount(size); int i = 0; for(float theta = 0; theta < 2 * PI; theta += theta_scale) { x = r*cos(theta); y = r*sin(theta); Vector3 pos = new Vector3(x, y, 0); lineRenderer.SetPosition(i, pos); i+=1; }
LineRenderer requires continuous points. You can modify this code a bit to use cylindrical game objects instead of a line renderer. I find LineRenderer a little disgusting.
Finally, like the first link, you can attach a circle texture to a unit plane. Make any part of the texture that is not part of the circle transparent. Then simply scale and align the plane to suit your subject. Unfortunately, this method is not very good if someone is looking almost parallel to the plane.
Jerdak
source share