UnityAsyncImageLoader icon indicating copy to clipboard operation
UnityAsyncImageLoader copied to clipboard

Change interface from byte[] to Memory<byte>

Open Blackclaws opened this issue 2 years ago • 1 comments

It would be great if the interface didn't take plain byte arrays. The reason being that you can't really allocate those easily from a block based system. Memory on the other hand is wrapper (like Span<>) around parts of memory that can be passed around between functions and stored in fields/properties. It supports pinning just like basic arrays do and byte[] should just be convertible to Memory so users of your library shouldn't be impacted by the API change.

Blackclaws avatar Mar 02 '23 13:03 Blackclaws

Not sure but since we're in Unity-land anyway, wouldn't it suffice to use NativeArray instead for the same benefits? This way we would not need the extra dependency.

krisrok avatar Jul 17 '23 09:07 krisrok