I have a line renderer and I want to show it as a dotted line. So I set the line material as a single dot sprite material. Following is my code.
lineRenderer.material = dottedLineMaterial;
lineRenderer.textureMode = LineTextureMode.Tile;
lineRenderer.material.SetTextureOffset("_MainTex", new Vector2(1.0f, 1.0f));
lineRenderer.positionCount = 2;
lineRenderer.SetPosition(0, clickPoints[lastIndex].position);
lineRenderer.SetPosition(1, point.transform.position);
lineRenderer.startWidth = lineRenderer.endWidth = lineWidth;
My expectation is a dotted line something like this.How can I properly set this material and what's wrong I have done?



