You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any time the Unity editor enters play mode after the initial run, an error message appears.
NullReferenceException: Object reference not set to an instance of an object
Unity.Collections.UnsafeQueueBlockPool.OnDomainUnload (System.Object sender, System.EventArgs e) (at ./Library/PackageCache/[email protected]/Unity.Collections/UnsafeQueue.cs:139)
System.AppDomain.DoDomainUnload () (at <8ce0bd04a7a04b4b9395538239d3fdd8>:0)
The text was updated successfully, but these errors were encountered:
This is caused by the property _eventQueue in PhysicsEngine.cs. If the property and all references to it are removed from the code, the error doesn't happen. It seems like the queue is not getting deallocated, despite the call to Dispose in OnDestroy(). The minimal code required to reproduce the error is simply:
using Unity.Collections;
using UnityEngine;
public class NullException : MonoBehaviour
{
private NativeQueue<bool> _eventQueue = new(Allocator.Persistent);
private void OnDestroy()
{
_eventQueue.Dispose();
}
}
Attaching this script to a game object and running the scene twice will cause the described NullReferenceException.
Any time the Unity editor enters play mode after the initial run, an error message appears.
The text was updated successfully, but these errors were encountered: