https://github.com/voltstro-studios/nativearrayspanextensions
Provides extensions to Unity's NativeArray that make using .NET's Span<T> with them easier.
https://github.com/voltstro-studios/nativearrayspanextensions
csharp dotnet extension span unity unity-2021 unity-extension unity-package upm upm-package
Last synced: 8 months ago
JSON representation
Provides extensions to Unity's NativeArray that make using .NET's Span<T> with them easier.
- Host: GitHub
- URL: https://github.com/voltstro-studios/nativearrayspanextensions
- Owner: Voltstro-Studios
- License: mit
- Created: 2022-08-07T14:45:00.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-10T08:00:22.000Z (over 2 years ago)
- Last Synced: 2025-01-31T03:54:08.664Z (8 months ago)
- Topics: csharp, dotnet, extension, span, unity, unity-2021, unity-extension, unity-package, upm, upm-package
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Native Array Span Extensions
[](/LICENSE.md)
[](https://discord.voltstro.dev)
[](https://www.youtube.com/Voltstro)Provides extensions to Unity's `NativeArray` that make using .NET's Span with them easier.
## Features
- Provides theses extensions to `NativeArray`:
- `CopyTo` for copying to a `Span`
- `CopyFrom` for copying from a `ReadOnlySpan`
- Same extensions are also available for `NativeSlice`
- Provides theses extensions to `Span` and `ReadOnlySpan`:
- `CopyTo` for copying a span to a `NativeArray`
- `ToNativeArray` for creating a new `NativeArray` and copying the span's buffer to it## Getting Started
### Package Installation
#### Prerequisites
```
Unity 2020.3.x
(Unity 2021.3.x is the recommended version however)
```(Newer Unity versions should be fine as well)
#### Unity 2020.3.x Prerequisites
**IF YOU ARE USING UNITY 2020.3.x WITH THIS PACKAGE, READ THIS**. (Newer versions do not need this step!)
`System.Memory` dll is required (this is where `Span` use to come from). This package it self has no direct dependent installation method for `System.Memory`. You can either install it directly into your Unity project from [NuGet](https://www.nuget.org/packages/System.Memory) (by extracting it from the `.nupkg` file), or via an automatic seamless UPM integration, such as [Voltstro UPM](https://github.com/Voltstro/VoltstroUPM#using-unitynuget-packages), [OpenUPM](https://openupm.com/nuget/), or [UnityNuGet](https://github.com/xoofx/UnityNuGet).
### Installation Methods
There are three main sources on how you can install this package. Pick which ever one suites you the best!
#### Voltstro UPM Registry
You can install this package from our custom UPM registry. To setup our registry,
see [here](https://github.com/Voltstro/VoltstroUPM#setup).Once you have the registry added to your project, you can install it like any other package via the package manager.
#### OpenUPM
You can install this package via [OpenUPM](https://openupm.com/).
To install it, use their CLI:
```bash
openupm add dev.voltstro.nativearrayspanextensions
```#### Git
To install it via the package manager with git you will need to:
1. Open up the package manager via Windows **->** Package Manager
2. Click on the little + sign **->** Add package from git URL...
3. Type `https://github.com/Voltstro-Studios/NativeArraySpanExtensions.git` and add it
4. Unity will now download and install the package## Authors
**Voltstro** - *Initial Work* - [Voltstro](https://github.com/Voltstro)
## License
This project is licensed under the MIT License - see the [LICENSE.md](/LICENSE.md) file for details.