I am attempting to do a pretty simple thing: Give the PlatformerCharacter from the CharacterController package a sword. However, when I add a trigger collider to the sword in PlatformerCharacter, I get NullReferenceExceptions every frame from a Physics.ColliderCast call while attempting update Grounding when moving from Air state to Ground state.
With Unity Physics 1.3.2, I see
NullReferenceException: Object reference not set to an instance of an object
Unity.Physics.Collider.CalculateAabb (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/Library/PackageCache/com.unity.burst@616862665d8c/.Runtime/Library/PackageCache/com.unity.physics@5ee9a9ca3bec/Unity.Physics/Collision/Colliders/Collider.cs:906)
0x00007ffd0bf94dc1 (606d6f82efaadda16475255247f441c) Unity.Physics.BoundingVolumeHierarchy.ColliderCast<Unity.Physics.Broadphase.BvhLeafProcessor,Unity.Physics.AllHitsCollector1<Unity.Physics.ColliderCastHit>> (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/Library/PackageCache/com.unity.burst@616862665d8c/.Runtime/Library/PackageCache/com.unity.physics@5ee9a9ca3bec/Unity.Physics/Collision/Geometry/BoundingVolumeHierarchy.cs:1426)
(...more stuff...)
Unity.CharacterController.KinematicCharacterAspect.Update_Grounding<PlatformerCharacterAspect,PlatformerCharacterUpdateContext> (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/Library/PackageCache/com.unity.burst@616862665d8c/.Runtime/Library/PackageCache/com.unity.charactercontroller@8f574cea3932/Unity.CharacterController/KinematicCharacterAspect.cs:758)
0x00007ffd0bf72781 (606d6f82efaadda16475255247f441c) AirMoveState.OnStatePhysicsUpdate (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/Assets/_Game/Code/Character/States/AirMoveState.cs:30)
0x00007ffd0bf79865 (606d6f82efaadda16475255247f441c) PlatformerCharacterAspect.PhysicsUpdate (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/Assets/_Game/Code/Character/PlatformerCharacterAspect.cs:104)
0x00007ffd0bf79e21 (606d6f82efaadda16475255247f441c) PlatformerCharacterPhysicsUpdateSystem.PlatformerCharacterPhysicsUpdateJob.Execute (at C:/Users/Devin/unity_ws/noodle-slayer/NoodleSlayer/JobEntityGenerator/Unity.Entities.SourceGen.JobEntityGenerator.JobEntityGenerator/Temp/GeneratedCode/Assembly-CSharp/PlatformerCharacterSystems__JobEntity_47621315386.g.cs:29)
If I update to Unity Physics 1.3.9 I get instead:
NullReferenceException: Object reference not set to an instance of an object
Unity.Physics.AllHitsCollector1[T].get_MaxFraction () (at ./Library/PackageCache/com.unity.physics@c7c1a8b1fcb4/Unity.Physics/Collision/Queries/Collector.cs:240)
Unity.Physics.BoundingVolumeHierarchy.ColliderCast[TProcessor,TCollector] (Unity.Physics.ColliderCastInput input, TProcessor& leafProcessor, TCollector& collector) (at ./Library/PackageCache/com.unity.physics@c7c1a8b1fcb4/Unity.Physics/Collision/Geometry/BoundingVolumeHierarchy.cs:1444)
(...yadda yadda...)
Unity.CharacterController.KinematicCharacterAspect.Update_Grounding[T,C] (T& processor, C& context, Unity.CharacterController.KinematicCharacterUpdateContext& baseContext, Unity.CharacterController.KinematicCharacterBody& characterBody, Unity.Mathematics.float3& characterPosition) (at ./Library/PackageCache/com.unity.charactercontroller@8f574cea3932/Unity.CharacterController/KinematicCharacterAspect.cs:748)
PlatformerCharacterAspect.HandlePhysicsUpdatePhase1 (PlatformerCharacterUpdateContext& context, Unity.CharacterController.KinematicCharacterUpdateContext& baseContext, System.Boolean allowParentHandling, System.Boolean allowGroundingDetection) (at Assets/_Game/Code/Character/PlatformerCharacterAspect.cs:168)
AirMoveState.OnStatePhysicsUpdate (PlatformerCharacterUpdateContext& context, Unity.CharacterController.KinematicCharacterUpdateContext& baseContext, PlatformerCharacterAspect& aspect) (at Assets/_Game/Code/Character/States/AirMoveState.cs:27)