Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Raycast doesn't work in IJobChunk

Discussion in 'Physics Previews' started by CorneliusCornbread, Nov 7, 2019.

  1. CorneliusCornbread

    CorneliusCornbread

    Joined:
    Jun 21, 2017
    Posts:
    32
    Doing a raycast in an IJobChunk I get the error:

    InvalidOperationException: The native container has been declared as [WriteOnly] in the job, but you are reading from it.
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <dfc62061cb3f4b1bb57c5179a5db6830>:0)
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <dfc62061cb3f4b1bb57c5179a5db6830>:0)
    Unity.Collections.LowLevel.Unsafe.NativeArrayUnsafeUtility.GetUnsafeReadOnlyPtr[T] (Unity.Collections.NativeArray`1[T] nativeArray) (at <dfc62061cb3f4b1bb57c5179a5db6830>:0)
    Unity.Physics.BoundingVolumeHierarchy..ctor (Unity.Collections.NativeArray`1[T] nodes, Unity.Collections.NativeArray`1[T] nodeFilters) (at Library/PackageCache/com.unity.physics@0.2.4-preview/Unity.Physics/Collision/Geometry/BoundingVolumeHierarchy.cs:26)

    Putting it into a ComponentSystem solves the problem
     
  2. CorneliusCornbread

    CorneliusCornbread

    Joined:
    Jun 21, 2017
    Posts:
    32
    Running 2019.3.0b8 btw