13-07-2023, 06:33 AM
(This post was last modified: 13-07-2023, 06:54 AM by josemendez.)
(13-07-2023, 06:26 AM)Oliran Wrote: I'm getting this same error in Unity 2022.3.4, which is not beta...
The error has to do with the version of the Collections package, not Unity. I was just pointing out a different issue to OP since he was having problems with NativeParallelHashMap possibly related to Unity 2023 beta: that betas (regardless of version number) are not supposed to be used in production, hence not officially supported.
Open up NativeMultilevelGrid.cs in your project, and replace the Cell<K> struct with this one, which uses UnsafeList<T> instead of UnsafeList:
Code:
public struct Cell<K> where K : unmanaged, IEquatable<K>
{
int4 coords;
UnsafeList<K> contents;
public Cell(int4 coords)
{
this.coords = coords;
contents = new UnsafeList<K>(4,Allocator.Persistent);
}
public int4 Coords
{
get { return coords; }
}
public int Length
{
get { return contents.Length; }
}
public void* ContentsPointer
{
get { return contents.Ptr; }
}
public K this[int index]
{
get
{
return contents.ElementAt(index);
}
}
public void Add(K entity)
{
contents.Add(entity);
}
public bool Remove(K entity)
{
int index = contents.IndexOf(entity);
if (index >= 0)
{
contents.RemoveAtSwapBack(index);
return true;
}
return false;
}
public void Dispose()
{
contents.Dispose();
}
}
let me know if that helps,
kind regards