Burst Error when drawing WireCylinder

Inside a burst job, drawing a WireCylinder results in an error:

(0,0): Burst error BC1015: Attempting to call a [BurstDiscard] method that returns a value 

Drawing.CommandBuilder.WithMatrix(Drawing.CommandBuilder* this, UnityEngine.Matrix4x4 matrix)` is not supported

Other primitives can be drawn without issue (WireSphere, WireBox etc.)

Hi, do you think you could post the exact code you are using?

Hey Aron,

I think the easiest to reproduce it is modifying the burstExample.cs.

instead of

builder.WireBox(bounds, new Color(0, 0, 0, 0.2f));

I replaced it by:

builder.WireCylinder(new float3(x, 0, z),new float3(x, 14*noise, z), 0.5f, Colormap(noise));	

There is exactly one exception raised for me at the start.

I think every drawing method which uses:
using (WithMatrix(Matrix4x4.TRS(position, ...

throws that exception.

Could you reproduce the exception?

Otherwise I can send you a zip with a project.

Oops, sorry. That was my fault. I used a using statement in the code which is not supported by burst.
A fix will be included in the next version. It was a quick fix of just replacing the WithMatrix call with PushMatrix and PopMatrix.

I tried to replace those calls, and use the math libraries float4x4 matrices.

Now the drawing works correctly, but other parts of the builder are throwing exceptions:

CommandBuilder.cs(2307,3): Burst error BC1360: A static constructor on type `Drawing.CommandBuilder` is mixing managed and unmanaged code which is not supported. In order to solve this, please move the managed code or unmanaged code to a different class/struct

I think there are coming from the strings used on the following static variables:

	private static readonly CustomSampler samplerConvert = CustomSampler.Create("Convert");
		private static readonly CustomSampler samplerLayout = CustomSampler.Create("SetLayout");
		private static readonly CustomSampler samplerUpdateVert = CustomSampler.Create("UpdateVertices");
		private static readonly CustomSampler samplerUpdateInd = CustomSampler.Create("UpdateIndices");
		private static readonly CustomSampler samplerSubmesh = CustomSampler.Create("Submesh");

That’s odd, I’m not seeing those errors at all.

Hey aron,

Any eta for the next version with the fixes?

Also, a dispose on job completion would be highly appreciated to be able to draw with scheduled jobs.

Also a fixedstring variant of the 2d label would be great to have (https://docs.unity3d.com/Packages/com.unity.collections@0.12/api/Unity.Collections.FixedString.html)

Submitted to the asset store. Will be live in a few days.

Included in the update.

1 Like

I just update my projects to the latest 1.0.0-pre.15 releases of ECS and dots, and the burst compile error is back.

Burst error BC1015: Attempting to call a [BurstDiscard] method that returns a value `Drawing.CommandBuilder.WithLineWidth(Drawing.CommandBuilder* this, float pixels, bool automaticJoins)` is not supported

I tried to use the builder in both an ISystem and SystemBase but it leads to the same burst compile error.

It’s most likely due to the [BurstDiscard] call on the WithLineWidth method, is there a burst-compatible version of it?

Ok just needed to replace the WithLineWidth call with PushLineWidth and it working now.

1 Like