Search Issue Tracker

In Progress

In Progress in 1.3.X, 7000.0.X

Votes

0

Found in [Package]

1.3.2 - Entities

7000.0.0a1

Issue ID

ECSB-1376

Regression

No

IndexOutOfRangeException when destroying Kinematic Body with Incremental Dynamic Broadphase enabled

Package: Unity Physics

-

*Steps to reproduce in Stars Reach project:*

# Follow the steps in the [Stars Reach project setup guide|https://docs.google.com/document/d/192I8dH8N0vnQKo83vVCyBymUlghkvAvjeqRuv5Y6KaM/edit?tab=t.0] about running the project in the Editor
#* Before launching the game: In SharedEntitiesSubscene.unity, enable dynamic incremental broadphase on the physics step authoring component:
!image-2024-12-03-12-35-47-506.png|thumbnail!
# Wait for your character to appear in the game world
# Hit the Enter key to bring up the chat window
# Send /spawn Creature.ballhog in chat to spawn a creature
# Send /kill mobs in chat to kill the creature

Note: If the /spawn command does nothing, you'll need to reach out to PlayableWorlds with your character name to get permissions added to your account.

*Steps to reproduce without Stars Reach project:*

*Note: these steps do not reproduce the issue.*

1. Enable "Incremental Dynamic Broadphase" on the Physics Step component

2. Attach a PhysicsBodyAuthoring component to a gameObject and set its MotionTypes to "Kinematic body"

3. Destroy the physics body at runtime

4. Observe an IndexOutOfRangeException in the console 

Exception:
{code:java}
IndexOutOfRangeException: Index 1 is out of range of '1' Length.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Unity.Physics.DispatchPairSequencer+CreateDispatchPairPhasesJob.FindFreePhaseDynamicStaticPair (Unity.Collections.NativeArray`1[T] rigidBodyMask, System.Int32 bodyIndexA, System.Int32 lastPhaseIndex, Unity.Collections.NativeArray`1[T] phaseLookupTableDynamicStaticPairs, System.Boolean useTable) (at ./Library/PackageCache/com.unity.physics@1.3.2/Unity.Physics/Dynamics/Simulation/Scheduler.cs:1170)
Unity.Physics.DispatchPairSequencer+CreateDispatchPairPhasesJob.CreateDispatchPairPhasesJobFunction (Unity.Collections.NativeArray`1[T] phaseLookupTableDynamicDynamicPairs, Unity.Collections.NativeArray`1[T] phaseLookupTableDynamicStaticPairs, Unity.Collections.NativeArray`1[T] dispatchPairs, System.Int32 numDynamicBodies, System.Int32 numPhases, Unity.Collections.NativeArray`1[T] phasedDispatchPairs, System.Int32& numActivePhases, System.Int32& numWorkItems, Unity.Collections.NativeArray`1[Unity.Physics.DispatchPairSequencer+SolverSchedulerInfo+SolvePhaseInfo]& phaseInfo, System.Boolean useTables) (at ./Library/PackageCache/com.unity.physics@1.3.2/Unity.Physics/Dynamics/Simulation/Scheduler.cs:914)
Unity.Physics.DispatchPairSequencer+CreateDispatchPairPhasesJob.Execute () (at ./Library/PackageCache/com.unity.physics@1.3.2/Unity.Physics/Dynamics/Simulation/Scheduler.cs:808)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
...{code}
*Actual results:* IndexOutOfRangeException

*Expected results:* No exceptions

*Reproducible with versions:* 1.3.2 (2022.3.18f1)

*Not reproducible with versions:* 

*Can’t test with versions:* 

*Tested on (OS):* Windows 11

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.