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
- Foldout arrow indent is misaligned in the Inspector when used in Custom Type
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
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.