public static NativeSlice <T> GetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel) where T : struct { SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel); SpriteChannelInfo channelInfo = SpriteDataAccessExtensions.GetChannelInfo(sprite, channel); NativeSlice <T> result = NativeSliceUnsafeUtility.ConvertExistingDataToNativeSlice <T>(channelInfo.buffer, channelInfo.offset, channelInfo.count, channelInfo.stride); 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>()); }