mbaske / grid-sensor

Grid Sensor Components for Unity ML-Agents
MIT License
134 stars 28 forks source link

Null reference for (Detectable Game Object 3D) script #4

Closed mehrdad-ataee closed 3 years ago

mehrdad-ataee commented 3 years ago

Hi, let me first thank you for making and sharing this great asset with us, I get the following error upon adding the (Detectable Game Object 3D) script to an object, even the default Cube,

The first time I tried, everything was working just fine but the next day, this happened and I think I have not modified anything in my game since the first successful attempt.

NullReferenceException: Object reference not set to an instance of an object MBaske.Sensors.Grid.ColliderScanner.Clear (System.Int32 size) (at Assets/MBaske Grid Sensor/Assets/Scripts/Sensors/Grid/GameObject/Detectable/Shape/ColliderScanner.cs:40) MBaske.Sensors.Grid.ColliderScanner.Scan (UnityEngine.PhysicsScene physicsScene, UnityEngine.Transform transform, System.Collections.Generic.IList1[T] colliders, System.Single resolution, System.Boolean is2D) (at Assets/MBaske Grid Sensor/Assets/Scripts/Sensors/Grid/GameObject/Detectable/Shape/ColliderScanner.cs:150) MBaske.Sensors.Grid.DetectableGameObject.ScanColliders () (at Assets/MBaske Grid Sensor/Assets/Scripts/Sensors/Grid/GameObject/Detectable/DetectableGameObject.cs:176) MBaske.Sensors.Grid.DetectableGameObject.OnDrawGizmosSelected () (at Assets/MBaske Grid Sensor/Assets/Scripts/Sensors/Grid/GameObject/Detectable/DetectableGameObject.cs:214) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)`

mehrdad-ataee commented 3 years ago

Restarting Unity fixed the issue, I tried to replicated what I did before but it didn't trigger the Error again.

Just wish there was a way to make it support MeshColliders without making them convex.