Amarcolina / NativeHeap

A Min/Max heap data structure for Unity. Compatible with the Unity Job system and Burst compiler.
MIT License
52 stars 3 forks source link

burst compile error #5

Open bbsuuo opened 2 years ago

bbsuuo commented 2 years ago

Burst error BC1042: The managed class type System.Int32* is not supported. Loading from a non-readonly static field Unity.Collections.NativeHeap2<int,Unity.Collections.Min>._nextId` is not supported

bbsuuo commented 2 years ago

find way to solve class GlobalTypeID { internal static int NextID() { //todo: this is not guaranteed to be unique, I must swap back to the increment! return Unity.Burst.BurstRuntime.GetHashCode32();

pragma warning disable 162

            return (Interlocked.Increment(ref value.Data) - 1);

pragma warning restore 162

        }

        static GlobalTypeID()
        {
            value.Data = 0;
        }

        static readonly Unity.Burst.SharedStatic<int> value =
            Unity.Burst.SharedStatic<int>.GetOrCreate<int, GlobalTypeID>();
    }

and change code _id = GlobalTypeID.NextID();//Interlocked.Increment(ref _nextId.Data);