Not sure what I’m doing wrong here. source has a BlobArray and BlobArray. The pointer should be good here being I can index into it via the blob array just fine. The debug statements all return correct values up until the last one where it throws a null reference on CheckElementReadAccess.
public unsafe void GetData(out NativeArray<int> indices, out NativeArray<float3> vertices)
{
ref var source = ref MeshData.Value;
Debug.Assert(source.Vertices.GetUnsafePtr() != null);
Debug.LogFormat("vert:{0} ind:{1} value:{2}", source.Vertices.Length, source.Indices.Length, source.Vertices[source.Vertices.Length - 1]);
indices = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<int>(source.Indices.GetUnsafePtr(), source.Indices.Length, Allocator.Temp);
vertices = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<float3>(source.Vertices.GetUnsafePtr(), source.Vertices.Length, Allocator.Temp);
Debug.LogFormat("length:{0}", vertices.Length);
Debug.LogFormat("value:{0}", vertices[0]);
}