public unsafe NativeArray <T> GetRawTextureData <T>() where T : struct { if (!isReadable) { throw CreateNonReadableException(this); } int stride = UnsafeUtility.SizeOf <T>(); var array = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray <T>((void *)GetWritableImageData(0), (int)(GetRawImageDataSize() / stride), Allocator.None); NativeArrayUnsafeUtility.SetAtomicSafetyHandle(ref array, Texture2D.GetSafetyHandle(this)); return(array); }
public unsafe NativeArray <T> GetRawTextureData <T>() where T : struct { bool flag = !this.isReadable; if (flag) { throw base.CreateNonReadableException(this); } int num = UnsafeUtility.SizeOf <T>(); NativeArray <T> result = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray <T>((void *)this.GetWritableImageData(0), (int)(this.GetRawImageDataSize() / (long)num), Allocator.None); NativeArrayUnsafeUtility.SetAtomicSafetyHandle <T>(ref result, Texture2D.GetSafetyHandle(this)); return(result); }