Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

ERROR: NativeArray<bool> fails in bursted job

Discussion in 'Burst' started by Attatekjir, Jun 15, 2019.

  1. Attatekjir

    Attatekjir

    Joined:
    Sep 17, 2018
    Posts:
    23
    Allocating a NativeArray<bool> works fine in a job. However, attempting to use it by assigning a boolean to it in any way result in an error with burst enabled. Disabeling the burst and running the job does not give an error and executes fine.

    Unexpected exception Burst.Compiler.IL.CompilerException: Error while verifying module: Stored value type does not match pointer operand type!
    store i32 %value, i8* %2, align 1
    i8

    at Burst.Compiler.IL.NativeCompiler.Compile () [0x00329] in <87cd2475da064e7d9ba0a1c1cfaade2b>:0

    at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x001b6] in <87cd2475da064e7d9ba0a1c1cfaade2b>:0

    at Burst.Compiler.IL.Jit.JitCompilerService.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x002bc] in <87cd2475da064e7d9ba0a1c1cfaade2b>:0

    While compiling job: System.Void Unity.Jobs.IJobExtensions/JobStruct`1<TESTJOB>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)

    Code (CSharp):
    1. [BurstCompile]
    2. public struct TESTJOB : IJob
    3. {
    4.     public void Execute()
    5.     {
    6.         //  Allocating the array with bool does not give an error
    7.         NativeArray<bool> array = new NativeArray<bool>(1, Allocator.Temp);
    8.         array[0] = true; // <-- it only errors when u actually assign values
    9.     }
    10. }


    I would have expected this to work in bursted jobs as it did in non bursted jobs.
     
  2. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    Which version of Burst are you using, and on which platform?
     
  3. Attatekjir

    Attatekjir

    Joined:
    Sep 17, 2018
    Posts:
    23
    My apologies, it seems installing/updating the latest Burst package resolved the issue.

    I did not realise that you had to manually install Burst as a package from package manager. I assumed Burst was in the Entities package and would update automatically when updating the Entities package.

    I am on Entities preview 30 and Windows 10 64bit.