Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Compatibility to Unity 2023.1
#9
(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
Reply


Messages In This Thread
Compatibility to Unity 2023.1 - by ImpossibleRob - 20-02-2023, 09:33 PM
RE: Compatibility to Unity 2023.1 - by josemendez - 21-02-2023, 08:41 AM
RE: Compatibility to Unity 2023.1 - by josemendez - 28-02-2023, 11:38 AM
RE: Compatibility to Unity 2023.1 - by josemendez - 28-02-2023, 03:12 PM
RE: Compatibility to Unity 2023.1 - by Oliran - 13-07-2023, 06:26 AM
RE: Compatibility to Unity 2023.1 - by josemendez - 13-07-2023, 06:33 AM