LizzyFox-code / UnsafeArray

A version of NativeArray from Unity.Collections with support of AllocatorManager.AllocatorHandle and without safety checks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

A version of NativeArray from Unity.Collections with support of AllocatorManager.AllocatorHandle and without safety checks. No need to use AllocatorManager (or CollectionHelper) API directly to allocate/deallocate array.

Dependencies

  • Unity Burst: 1.8.8
  • Unity Collections: 2.1.4

Usage

Allocate UnsafeArray

var unsafeArray = new UnsafeArray<int>(100, Allocator.TempJob);

Allocate UnsafeArray with custom allocator

// customAllocator is a implementation of AllocatorManager.IAllocator
var allocatorHandle = customAllocator.Handle;
var unsafeArray = new UnsafeArray<int>(100, allocatorHandle);

Deallocate UnsafeArray

unsafeArray.Dispose();

Deallocate UnsafeArray with Job

var disposeHandle = unsafeArray.Dispose(dependencyHandle);

About

A version of NativeArray from Unity.Collections with support of AllocatorManager.AllocatorHandle and without safety checks.

License:MIT License


Languages

Language:C# 100.0%