Files
adriadri6972 d3d9c5f833 upload project
2025-07-31 15:21:08 +02:00

27 lines
650 B
C#

using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
namespace Unity.XR.XREAL
{
unsafe struct NativeView
{
public void* data;
public int count;
}
static class NativeViewExtensions
{
public static unsafe NativeView AsNativeView<T>(this NativeArray<T> array) where T : struct => new()
{
data = array.GetUnsafePtr(),
count = array.Length
};
public static unsafe NativeView AsNativeView<T>(this NativeSlice<T> slice) where T : struct => new()
{
data = slice.GetUnsafePtr(),
count = slice.Length
};
}
}