public unsafe static NativeSlice <T> GetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel) where T : struct { SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel); SpriteChannelInfo channelInfo = SpriteDataAccessExtensions.GetChannelInfo(sprite, channel); byte * dataPointer = (byte *)channelInfo.buffer + channelInfo.offset; NativeSlice <T> result = NativeSliceUnsafeUtility.ConvertExistingDataToNativeSlice <T>((void *)dataPointer, channelInfo.stride, channelInfo.count); NativeSliceUnsafeUtility.SetAtomicSafetyHandle <T>(ref result, sprite.GetSafetyHandle()); return(result); }
public static void SetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel, NativeArray <T> src) where T : struct { SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel); SpriteDataAccessExtensions.SetChannelData(sprite, channel, src.GetUnsafeReadOnlyPtr <T>()); }