Reposting IN-52716 here because I haven’t seen anyone mention this error. Not sure if I’m doing something wrong here.
What happened
Errors are logged in the console when an Occluder component is added in the subscene.
How can we reproduce it using the example you attached
Open the project in 2022.3.8f1
Open the “Main Scene”
Move the scene view camera near the scene origin (framing the object)
Enable “Force On” safety checks or disable Burst compilation
The following error is logged in the console:
IndexOutOfRangeException: Index 1 is out of restricted IJobParallelFor range [0...0] in ReadWriteBuffer.
ReadWriteBuffers are restricted to only read & write the element at the job index. You can use double buffering strategies to avoid race conditions due to reading & writing in parallel to the same elements from a job.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
Unity.Rendering.Occlusion.Masked.Dots.OcclusionMesh.Transform (Unity.Mathematics.float4x4 mvp, UnityEngine.Rendering.BatchCullingProjectionType projectionType, System.Single nearClip, Unity.Burst.Intrinsics.v128* frustumPlanes, System.Single halfWidth, System.Single halfHeight, System.Single pixelCenterX, System.Single pixelCenterY, Unity.Mathematics.float4* transformedVerts, Unity.Collections.NativeArray`1[T] clippedVerts, Unity.Collections.NativeArray`1[T] clippedTriExtents, Unity.Rendering.Occlusion.Masked.ClippedOccluder* clipped) (at ./Library/PackageCache/com.unity.entities.graphics@1.0.14/Unity.Entities.Graphics/Occlusion/Masked/Dots/OccluderMesh.cs:274)
Unity.Rendering.Occlusion.Masked.MeshTransformJob.Execute (System.Int32 i) (at ./Library/PackageCache/com.unity.entities.graphics@1.0.14/Unity.Entities.Graphics/Occlusion/Masked/MeshTransformJob.cs:55)
Unity.Jobs.IJobForExtensions+ForJobStruct`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
This is currently blocking us from implementing occlusion culling before Next Fest, so I’d appreciate an update. I think this error might also be causing crashes (reported separately as IN-52679).
Thanks - We’ve tried your workaround, and it looks like it gets rid of the errors, but enabling ENABLE_UNITY_OCCLUSION still causes frequent crashes in editor when reloading the domain (eg. entering/exiting play mode) for some reason (in the same minimal “single box with occluder” repro project). It’s a separate issue, presumably?
Hello, as you might know, Burst Occlusion Culling will be removed so we won’t be able to provide support for it in the future.
However, you should be able to avoid this error by making sure Burst compilation is enabled.