Immediate mode Draw.Line not appearing in standalone build.
I am attempting to use the new ImmediateModeShapeDrawer to compare drawing a parametric curve in immediate mode using Draw.Polyline and Draw.Line respectively.
While both approaches work in the editor's Game View, Draw.Line calls do not appear to work in a standalone build:
(Left is standalone build, right is editor Game view).
The complete test code is as follows:
using Shapes;
using UnityEngine;
[ExecuteAlways]
public class ShapesLineTest : ImmediateModeShapeDrawer
{
public bool usePolyLine;
public Color color = Color.red;
const float thickness = 0.2f;
const int count = 128;
public override void DrawShapes(Camera cam)
{
using (Draw.Command(cam))
using(PolylinePath polyPath = new PolylinePath())
{
for (int i = 0; i < count + 1; ++i)
{
float param01 = i / (float)count;
Vector3 point = GetPoint(param01);
polyPath.AddPoint(point);
}
Draw.ResetAllDrawStates();
Draw.Matrix = transform.localToWorldMatrix;
Draw.BlendMode = ShapesBlendMode.Opaque;
Draw.LineGeometry = LineGeometry.Volumetric3D;
Draw.LineThicknessSpace = ThicknessSpace.Meters; Draw.LineThickness = 1;
if (usePolyLine)
{
Draw.Polyline(polyPath, closed: false, thickness: thickness, color: color);
}
else
{
Vector3 lastPoint = polyPath[0].point;
for (int i = 1; i < polyPath.Count; ++i)
{
Vector3 curPoint = polyPath[i].point;
Draw.Line(lastPoint, curPoint, thickness, color);
lastPoint = curPoint;
}
}
}
}
private static Vector3 GetPoint(float param01)
{
float param = Mathf.Lerp(-Mathf.PI, Mathf.PI, param01);
return new Vector3(param, Mathf.Sin(param * 2), 0);
}
}
Is there a reason why Draw.Line calls might not be showing up for me in a standalone build, while Draw.Polyline calls are? This is a test project that only contains this code and I have not changed any Shapes settings from their defaults. The camera is unchanged except for its clear mode being set to color instead of Skybox.
I used the examples on https://acegikmo.com/shapes/docs/#immediate-mode and was unable to find anything there that might explain this behavior, but I'm hoping I just missed something obvious.
Best,
Johannes
this has now been fixed in 3.0.1