Search Issue Tracker
By Design
Votes
2
Found in [Package]
0.14.0-preview.18
Issue ID
1272792
Regression
No
SystemBase.GetBuffer is not declared as a [ReadOnly] when used only for reading in Entities.ForEach lambda expression
How to reproduce:
1. Open the attached project (case-1272792.zip)
2. Enter Play Mode
Expected result: no errors are logged in the Console window when calling SystemBase.GetBuffer
Actual result: an error is spammed in the Console: 'InvalidOperationException: <>c__DisplayClass_OnUpdate_LambdaJob0.JobData._BufferFromEntity_Buffer_0 is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.'
Reproducible with: 0.13.0-preview.24 (2020.1.4f1), 0.14.0-preview.18 (2020.2.0a21)
Could not test with: 0.0.12-preview.24 (2018.4.26f1), 0.11.1-preview.4 (2019.4.8f1) ('test.cs' Script is not compatible)
Workaround:
Passing the buffer as one of the lambda function parameters
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- The dithering node returns a blocky effect when the Render Scale is set to some values below 1
- [Android Module] Unity double writes files in the "StreamingAssets" folder when they are deleted using "IPostGenerateGradleAndroidProject" after the Grandle project is generated
- IndexOutOfRangeException and InvalidOperationException when clicking on the HTML log in the Console
- Warnings "Attempting to draw with missing bindings" are logged when opening the HDRP VFX Template Sample Scene
- Red spots appear when Blending Lighting Scenarios using Adaptive Probe Volumes
Resolution Note:
This would be very difficult to do automatically from a codegen standpoint (we would have to examine every possible code path that could be executed and check to see if any of them write to the DynamicBuffer). We are however exploring adding a separate API for getting a read-only buffer.