ImmediateModeShapeDrawer not drawing second set of shapes
Hello,
I'm liking the Shapes asset and working through understanding the Immediate Mode Drawing.
I'm playing around with what can be done and came across a problem that I don't understand. I have two sets of loops where the first draws a bunch of triangles and the second draws some discs. For some reason the discs are not drawn. The code is as follows:
public class TestImmediateExtra : ImmediateModeShapeDrawer
{
[SerializeField] private Camera cam;
public override void DrawShapes(Camera cam)
{
if (cam != this.cam)
{
return;
}
using (Draw.Command(cam))
{
// set up static parameters. these are used for all following Draw.Line calls
Draw.ResetAllDrawStates();
Draw.LineGeometry = LineGeometry.Flat2D;
Draw.ThicknessSpace = ThicknessSpace.Meters;
Draw.Thickness = 0.03f;
Draw.BlendMode = ShapesBlendMode.Opaque;
Draw.Color = Color.white;
// set static parameter to draw in the local space of this object
Draw.Matrix = transform.localToWorldMatrix;
for (int x = -10; x < 10; x++)
{
for (int y = -10; y < 10; y++)
{
Vector3 pointA = new Vector3(x, y, 0);
Vector3 pointB = new Vector3(x, y, 0) + Vector3.up;
Vector3 pointC = new Vector3(x, y, 0) + Vector3.right;
Draw.TriangleBorder(pointA, pointB, pointC);
//Draw.Disc(new Vector3(x, y, 0f), 0.2f, Color.blue);
}
}
for (int x = -5; x < 5; x++)
{
for (int y = -5; y < 5; y++)
{
Draw.Disc(new Vector3(x, y, 0f), 0.2f, Color.blue);
}
}
}
}
}If I uncomment the line after drawing the triangle, it works. I don't understand why one way works and the other does not. I get there's a lot of low-level graphics stuff like draw calls and stuff that I don't understand, so I'm guessing that's probably the reason. Did I structure the calls wrong?
I appreciate any help in understanding this. Thanks!
- Jason
Reporting a bug? please specify Unity version:
Unity 6.3 LTS (6000.3.10f1)
Reporting a bug? please specify Shapes version:
4.5.1
Reporting a bug? please specify Render Pipeline:
URP