Looooong / UnityAsyncImageLoader

Asynchronous Image Loader for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change interface from byte[] to Memory<byte>

Blackclaws opened this issue · 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.

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.