If this [ReadOnly] break sth, I guess it should throw some exception right? Other logic except this buffer runs fine, weirdly.
Package ver:
Entities 0.2.0 preview.
How to reproduce:
In IJobForEach<buffer, component>, mark Component which has BlobAssetReference with [ReadOnly]. Then buffer.Add(new elem);
NullReferenceException: Object reference not set to an instance of an object
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Jobs/AtomicSafetyHandle.bindings.cs:152)
Unity.Entities.DynamicBuffer1[T].CheckWriteAccess () (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/Iterators/DynamicBuffer.cs:123) Unity.Entities.DynamicBuffer1[T].Add (T elem) (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/Iterators/DynamicBuffer.cs:271)
MuYin.EatConsiderSystem+EatConsidererJob.Execute (Unity.Entities.DynamicBuffer1[T] b0, Unity.Entities.DynamicBuffer1[T] b1, MuYin.ActionInfo& c1, MuYin.ActionSetting& c2) (at Assets/MuYin/Scripts/MuYin/System/Game/AI/UtilityAI/Consideration/EatConsiderSystem.cs:36)
Unity.Entities.JobForEachExtensions+JobStruct_Process_BBCC5[T,T0,T1,T2,T3].ExecuteChunk (Unity.Entities.JobForEachExtensions+JobStruct_Process_BBCC5[T,T0,T1,T2,T3]& jobData, System.IntPtr bufferRangePatchData, System.Int32 begin, System.Int32 end, Unity.Entities.ArchetypeChunk* chunks, System.Int32* entityIndices) (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/IJobForEach.gen.cs:4020)
Unity.Entities.JobForEachExtensions+JobStruct_Process_BBCC5[T,T0,T1,T2,T3].Execute (Unity.Entities.JobForEachExtensions+JobStruct_Process_BBCC5[T,T0,T1,T2,T3]& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/IJobForEach.gen.cs:3976)
After removing this attribute, everything works fine.