Support Forum

Burst Error BC1091 When drawing wireCylinder inside a SystemBase

Hi,

Working with Unity DOTS/ECS and when using ALINE inside a SystemBase
As so…

protected override void OnUpdate()
{
 CommandBuilder drawBuilder = DrawingManager.GetBuilder(true)

Dependency = Entities.Foreach((Entity e, Translation t) => 
{
drawBuilder.WireCapsule(...);
}).Schedule();

drawBuilder.DisposeAfter(Dependency);
}

Causes the following error:
Burst error BC1091: External and internal calls are not allowed inside static constrcutors: UnityEngine.Quaternion.Internal_FromEulerRad_Injected(ref UnityEngine.Vector3 euler, ref UnityEngine.Quaternion ret)

Thanks!
I have fixed this locally, and the fix will be included in the next update.

Can you share how you fixed it locally so that I can replicate it in the meantime?

Hi

The new version is available on the asset store, you should be able to use that one :slight_smile:

Update introduces a plethera of other errors/issues as described in your Discord. for tracking sake I’ve included the messages and images here aswell.

I get these errors/messages with WireCapulse & WireCyllinder (no errors with WireCubes)

also, might help you narrow it down, once exiting playmode the allocation logs + the TLS allocator error keep climbing when the editor is my active window

Actual code is as follows

Hi

I cannot replicate this, at least not using an IParallelForJob (which should be roughly equivalent to Entities.ForEach) :frowning:

Can you replicate this in an empty scene with only that code running?

I tried the same code on a new project. and lo and behold, It worked without errors.
I went back to my project and still hade these errors. So I started looking into what part of the code was causing these errors. When passing new float3(0,0,1) into the direction parameter into the WireCapsule() it did NOT throw any errors. So into the function I went.
I had an assumption that the Quaternion.LookRotation was causing something to happen, so… I commented the entire PushMatrix line out (aswell as the corresponding PopMatrix()) and tada…
No errors. So I switched the Matrix4x4.TRS call into the float4x4.TRS call aswell as changed the Quaternion.LookRotation call into the quaternion.LookRotation() (the new math library one) I had to normalize the direciton and tangent though since this new function expects them to be normalized. I then ran into an exception “NaN bounds. A Draw.* command may have been given NaN coordinates.” However, my capsules were drawing just fine. So I just commented out this comment and now i’m back without any errors and the drawing is working as expected. Hopefully this could give you an insight into how and/or why this was happening on my end, but it definetely seemed to be related to the direction parameter…

Hi

Hmm, okay I think I forgot to handle the case where the direction parameter is (0,0,0) (or very close to zero).
I couldn’t replicate the push/pop errors, though.

I have a fix for this which will be included in the next update.

Care to share what you changed, I can check if it changes anything on my end?

Hi

Sorry for the late reply, I’ve been sick these last few weeks.

Here’s the diff for the changes I made: commit 0962c43915dc6c07110b6826e43891bc826ec049Author: Aron Granberg <aron.gra - Pastebin.com