I’m having difficulty understanding how to do this properly. I get an error on line 16 which reads:
“Pointers and fixed size buffers may only be used in an unsafe context [Assembly-CSharp]csharp(CS0214)”
public struct Poly : IDisposable
{
public bool isClosed;
public AABB AABB;
UnsafeList<float3> points;
public Poly (bool closed)
{
isClosed = closed;
AABB = new AABB();
points = new UnsafeList<float3>(3, Allocator.Persistent);
}
// ...
public void AddPoints(ref NativeList<float3> pts)
{
points.AddRange(pts.GetUnsafeReadOnlyPtr(), pts.Length);
UpdateBounds();
}
// ...
}
Somewhat off topic, but if I have a NativeList and Dispose it, will each Poly item have its Dispose method invoked automatically?