-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListUtils.cs
36 lines (31 loc) · 861 Bytes
/
ListUtils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#nullable enable
using System.Collections.Generic;
using Unity.Collections;
using Unity.Entities;
namespace VRisingServerApiPlugin;
public static class ListUtils
{
public static List<T> Convert<T>(DynamicBuffer<T> buffer) where T : unmanaged {
var _list = new List<T>();
foreach (var entity in buffer) {
_list.Add(entity);
}
return _list;
}
public static List<T> Convert<T>(NativeArray<T> array) where T : unmanaged {
var _list = new List<T>();
foreach (var entity in array) {
_list.Add(entity);
}
return _list;
}
public static List<T> Convert<T>(NativeList<T> list) where T : unmanaged
{
var _list = new List<T>();
foreach (var entity in list)
{
_list.Add(entity);
}
return _list;
}
}