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
- [iOS]"The destination host has an erroneous SSL certificate" error is thrown when using UnityWebRequest to connect to the server with a self-signed certificate
- Freeze/crash on DynamicHeapAllocator::Allocate when opening a specific project
- Text Settings Inspector sections names have no padding
- UI elements shrinking, misaligned buttons, swapped icons, or incorrect styles when rapidly cycling through Scenes in the Player
- Text field does not disappear if Ctrl+Z is pressed while editing in Viewport
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.