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
- [Android] The Player freezes when disabling Bluetooth while connected to the headphones
- Addressable bundles are not retrieved from the cache when a WebGL Player is refreshed
- Sprites are incorrectly occluded by Sprite Physics Shape culling when behind in sorting order
- CPU usage is increased when the Editor is idle with the ProBuilder Package installed
- Unstable lighting when additional light sources are added in Shader Graph nodes
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.