Search Unity

Exclusive Entity Transaction Burst Compile Error

Discussion in 'Burst' started by Soaryn, May 27, 2019.

  1. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    For data that is being provided by a 3rd party in unknown quantities, I am spawning entities to represent the data.

    My first attempt was to use the Command Buffer system, but in the case of say spawning in 10k entities of varying data types it wound up bogging down to much if spawning in too many at a time since we are constructing the entire entity runtime and know very little compile time.

    The second attempt was to use the Exclusive Entity Transaction method of spawning all of my entities in a different world via a job, and this works magnificently. I can build and spawn the entities extremely fast.

    My third thought was to use burst compile. Now, understandably, burst doesn't support the CommandBuffer yet (to my knowledge of the time of this post); however, it SEEMS to work with the Exclusive Entity Transaction; however, despite it working, there seems to be a logged error when ever you try to use ExclusiveEntityTransaction.CreateEntity() in a job.

    As I mentioned, it SEEMS to work, but I have no way at the moment, to guarantee whether or not that is true. My question: is there a possibility the burst compiler throwing a false positive for an error?

    Error logged:
    Code (CSharp):
    1. D:\Development\Unity\Projects\Noti\Assets\Noti\Experimental\ExternalWorldTest.cs(127,21): error: Unexpected error while processing function `Noti.Experimental.ExternalWorldTest.BuildEntityJob.Execute(Noti.Experimental.ExternalWorldTest.BuildEntityJob* this)`. Reason: Object reference not set to an instance of an object
    2. at Noti.Experimental.ExternalWorldTest.BuildEntityJob.Execute(Noti.Experimental.ExternalWorldTest.BuildEntityJob* this) (at D:\Development\Unity\Projects\Noti\Assets\Noti\Experimental\ExternalWorldTest.cs:120)
    3. at Unity.Jobs.IJobExtensions.JobStruct`1<Noti.Experimental.ExternalWorldTest.BuildEntityJob>.Execute(ref Noti.Experimental.ExternalWorldTest.BuildEntityJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\buildslave\unity\build\Runtime\Jobs\Managed\IJob.cs:30)
    4.  
    5. Internal compiler exception: System.NullReferenceException: Object reference not set to an instance of an object
    6.   at Burst.Compiler.IL.Helpers.CecilExtensions.IsGCType (Mono.Cecil.TypeReference typeRef) [0x00000] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    7.   at Burst.Compiler.IL.Syntax.ILFunctionReference..ctor (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Syntax.GenericContext genericContext, System.Boolean isEntryPoint) [0x004c4] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    8.   at Burst.Compiler.IL.Syntax.ILBuilder.Call (Mono.Cecil.Cil.Instruction inst, Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Syntax.ILExpression thisArgument) [0x000e7] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    9.   at Burst.Compiler.IL.Syntax.ILBuilder.ProcessInstruction (Mono.Cecil.Cil.Instruction inst) [0x003d6] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    10.   at Burst.Compiler.IL.Syntax.ILBuilder.ProcessInstructions () [0x00099] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    11.   at Burst.Compiler.IL.Syntax.ILBuilder.ProcessFunctionBody () [0x00080] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    12.   at Burst.Compiler.IL.Syntax.ILBuilder.CreateFunctionFromRef (Burst.Compiler.IL.Syntax.ILFunctionReference funcRef) [0x000dc] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    13.   at Burst.Compiler.IL.Syntax.ILBuilder.VisitPendingFunctionReferences () [0x000c1] in <bbb9a8f1ad8e40f882ae7118e307be8e>:0
    14.  
    15. While compiling job: System.Void Unity.Jobs.IJobExtensions/JobStruct`1<Noti.Experimental.ExternalWorldTest/BuildEntityJob>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
    16.