#Job struct being forced into auto layout.

1 messages · Page 1 of 1 (latest)

inner yarrow
#

Hello. I am getting this error:

(0,0): Burst error BC1045: Struct `TerraPunk.UnitManagement.PathfinderJob&` with auto layout is not supported

 at Unity.Jobs.IJobExtensions.JobStruct`1<TerraPunk.UnitManagement.PathfinderJob>.Execute(ref TerraPunk.UnitManagement.PathfinderJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex)


While compiling job:
Unity.Jobs.IJobExtensions+JobStruct`1[[TerraPunk.UnitManagement.PathfinderJob, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(TerraPunk.UnitManagement.PathfinderJob&, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)

Here is my code: https://hastebin.com/share/depigivepe.csharp

Why is it being forced into auto layout?

visual talon
#

(your link doesn't work)

inner yarrow
#

thanks though lol

visual talon
#

public readonly UnsafeList<(int3 position, float weight)> neighbors;

#

pretty sure this will be your issue

#

you can use tuples in burst

#

but you can't pass them across the mono <-> burst barrier

#

because they have different layouts

#
    public struct Pair
    {
        public int3 position;
        public float weight;
        public Pair(int3 position, float weight)
        {
            this.position = position;
            this.weight = weight;
        }
    }```
replacing with that and it compiles fine
inner yarrow
#

ok I'll just make a pair then yea.

#

let me try

#

@visual talon thank you, that was causing it. However, I was not passing the tuple between the mono<->burst barrier to my knowledge.

visual talon
#

burst doesn't know that

#

private NativeList<Node> _openNodes;

#

is part of your job struct

inner yarrow
visual talon
#

just passed within methods

#

useful for a return from 1 method and using the result etc

#

really looking forward to struct records when we get them for this case though