Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using Unity.Collections;
using UnityEngine;
[ExecuteAlways]
public class TempAllocTest : MonoBehaviour
{
private NativeHashMap<int, int> Map;
private void OnEnable()
{
Map = new NativeHashMap<int, int>(64, Allocator.Persistent);
for(int i=0;i<1024 * 512;i++)
{
Map[i] = default;
}
}
private void OnDisable()
{
if (Map.IsCreated) Map.Dispose();
}
private void OnDrawGizmosSelected()
{
if (!Map.IsCreated) return;
var keys = Map.GetKeyArray(Allocator.Temp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment