Created
February 17, 2022 18:53
-
-
Save gamemachine/f8f1781969ca2c63e5b43769797c88b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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