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
- Highlighter.Highlight does not find window when using class name as window title
- Highlighter.Highlight highlights a different component when multiple components have the same property path
- Highlighter.Highlight does not find elements in an array or list when the array or list is collapsed
- [URP][NRP] RenderPass, BeginSubPass, and EndRenderPass errors are thrown when Native RenderPass is enabled
- D3D11 swapchain error pop-up appears and the Editor shuts down when Generating Lighting with Probe Volumes present
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.