Hello,
I just installed unity physics on my project. I also imported the custom physics authoring sample.
I add Physics Shape component. It works with any setting, except Convex Hull and Mesh Colliders (which is what I need, since I’m working with hexagons).
As soon as I choose Mesh or Convex Hull, it doesn’t generate it and it drops the following error constantly
InvalidOperationException: The Unity.Collections.NativeList`1[Unity.Mathematics.float3] GetAabbJob.Points can no longer be accessed, since its owner has been invalidated. You can simply Dispose() the container and create a new one.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Unity.Jobs.IJobExtensions.Run[T] (T jobData) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Unity.Physics.Authoring.PhysicsShapeAuthoring.BakePoints (Unity.Collections.NativeArray`1[T] points) (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom/Bodies/PhysicsShapeAuthoring.cs:807)
Unity.Physics.Authoring.PhysicsShapeExtensions.GetBakedConvexProperties (Unity.Physics.Authoring.PhysicsShapeAuthoring shape, Unity.Collections.NativeList`1[T] pointCloud) (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom/Utilities/PhysicsShapeExtensions.cs:294)
Unity.Physics.Editor.PhysicsShapeAuthoringEditor+PreviewMeshData.GetInputHash (Unity.Physics.Authoring.PhysicsShapeAuthoring shape, Unity.Collections.NativeList`1[T] currentPoints, Unity.Collections.NativeArray`1[T] hashedPoints, Unity.Physics.ConvexHullGenerationParameters hashedConvexParameters, Unity.Physics.ConvexHullGenerationParameters& currentConvexProperties) (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom.Editor/Editors/PhysicsShapeAuthoringEditor.cs:241)
Unity.Physics.Editor.PhysicsShapeAuthoringEditor+PreviewMeshData.SchedulePreviewIfChanged (Unity.Physics.Authoring.PhysicsShapeAuthoring shape) (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom.Editor/Editors/PhysicsShapeAuthoringEditor.cs:273)
Unity.Physics.Editor.PhysicsShapeAuthoringEditor.GetPreviewData (Unity.Physics.Authoring.PhysicsShapeAuthoring shape) (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom.Editor/Editors/PhysicsShapeAuthoringEditor.cs:450)
Unity.Physics.Editor.PhysicsShapeAuthoringEditor.OnSceneGUI () (at Assets/Samples/Unity Physics/1.0.16/Custom Physics Authoring/Unity.Physics.Custom.Editor/Editors/PhysicsShapeAuthoringEditor.cs:1098)
(wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,UnityEditor.Editor)
UnityEditor.SceneView.CallOnSceneGUI () (at <78fe3e0b66cf40fc8dbec96aa3584483>:0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at <78fe3e0b66cf40fc8dbec96aa3584483>:0)
UnityEditor.SceneView.DoOnGUI () (at <78fe3e0b66cf40fc8dbec96aa3584483>:0)
UnityEditor.SceneView.OnSceneGUI () (at <78fe3e0b66cf40fc8dbec96aa3584483>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <f6650f702d1247c2a5311a89b759ba03>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <f6650f702d1247c2a5311a89b759ba03>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <d26551307ee24906965335845380d4a1>:0)
The specific line is: “new PhysicsShapeExtensions.GetAabbJob { Points = points, Aabb = aabb }.Run();” in the following context:
internal unsafe void BakePoints(NativeArray<float3> points)
{
var localToShapeQuantized = GetLocalToShapeMatrix();
using (var aabb = new NativeArray<Aabb>(1, Allocator.TempJob))
{
new PhysicsShapeExtensions.GetAabbJob { Points = points, Aabb = aabb }.Run();
HashableShapeInputs.GetQuantizedTransformations(localToShapeQuantized, aabb[0], out localToShapeQuantized);
}
using (var bakedPoints = new NativeArray<float3>(points.Length, Allocator.TempJob, NativeArrayOptions.UninitializedMemory))
{
new BakePointsJob
{
Points = points,
LocalToShape = localToShapeQuantized,
Output = bakedPoints
}.Schedule(points.Length, 16).Complete();
UnsafeUtility.MemCpy(points.GetUnsafePtr(), bakedPoints.GetUnsafePtr(), points.Length * UnsafeUtility.SizeOf<float3>());
}
}
Any ideas why this may be happening? I literally just installed it, no modifications or anything. It also fails with a basic cube shape, by the way.