Ok finally got a break and have a repro. It appears to be the specific combination of BufferFromEntity and NativeDisableContainerSafetyRestriction. The debug will spit out different values then what was set for the long values.
Probably avoidable by not passing the buffer like I am the code is fairly old.
This is on 2020.1 b16 Entities 0.11.1-preview4. Collections is in dev so we can have a newer CompilerServices.Unsafe that’s the only custom mods I can think of that would matter. Rest are higher level feature stuff.
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace AiNav
{
[InternalBufferCapacity(16)]
public struct Bug1TestBuffer : IBufferElementData
{
public static implicit operator float3(Bug1TestBuffer e) { return e.Value; }
public static implicit operator Bug1TestBuffer(float3 e) { return new Bug1TestBuffer { Value = e }; }
public float3 Value;
}
public unsafe struct Bug1TestJob
{
public long A;
public long B;
[NativeDisableContainerSafetyRestriction]
public BufferFromEntity<Bug1TestBuffer> Lookup;
public void Execute()
{
Debug.LogFormat("Withcode {0} {1}", A, B);
}
}
//[DisableAutoCreation]
[AlwaysUpdateSystem]
public class Bug1TestSystem : SystemBase
{
protected override unsafe void OnCreate()
{
base.OnCreate();
}
protected override void OnDestroy()
{
base.OnDestroy();
}
protected override unsafe void OnUpdate()
{
long a = 123456789223;
long b = 4234234234234;
Bug1TestJob job1 = new Bug1TestJob()
{
A = a,
B = b,
Lookup = GetBufferFromEntity<Bug1TestBuffer>(false)
};
Job
.WithoutBurst()
.WithCode(() =>
{
job1.Execute();
}).Schedule();
}
}
}