Search Issue Tracker

By Design

Votes

0

Found in [Package]

1.3.5 - Entities

7000.0.0a1

Issue ID

ECSB-1371

Regression

Yes

Entity is "null" when retrieving Compound Collider Leaf

Package: Unity Physics

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Scenes/SampleScene” Scene
3. Enter the Play Mode
4. Press “Left Mouse” in the Game View
5. Observe the Console window

Expected result: The “Hit Entity” prints out an entity
Actual result: The “Hit Entity” prints out {{null}}

Reproducible with: 1.1.0-pre.3 (2022.3.50f1), 1.3.5 (2022.3.50f1, 6000.0.23f1)
Not reproducible with: 1.1.0-exp.1 (2022.3.50f1)
Couldn’t test with: 2021.3.45f1 - No Entities support

Reproducible on: Windows 10, Windows 11 (user)
Not reproducible on: No other environment tested

  1. Resolution Note:

    Since Unity Physics 1.2, this is expected behavior.
    The original Entities for compound collider children which were used during baking have to be retrieved via the PhysicsColliderKeyEntityPair buffer located on the rigid body entity.
    https://docs.unity3d.com/Packages/com.unity.physics@1.3/api/Unity.Physics.PhysicsColliderKeyEntityPair.html

    The Entity member in the CompoundCollider children is no longer set automatically during baking since the Entities can not be guaranteed to be valid. This was causing invalid Entity entries here in previous Unity Physics versions under certain circumstances, including various fundamental operations on the Entities world that were automatically performed by the framework, such as the copying of Entities during baking.
    The Entity entries in the PhysicsColliderKeyEntityPair buffer are guaranteed to remain correct, ensuring that you can still retrieve the original entities for the compound collider children from this buffer at all times.

    The CompoundCollider child Entity member is Entity.Null by default and can be used at runtime by the user for storing Entities, e.g., for associating user data with the compound collider children, as also documented here:
    https://docs.unity3d.com/Packages/com.unity.physics@1.3/api/Unity.Physics.CompoundCollider.Child.html#Unity_Physics_CompoundCollider_Child_Entity

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.