Skip to content

ColliderCachePlugin is missing a dependency on AssetEvent<Mesh> / bevy_mesh::MeshPlugin #983

@mgi388

Description

@mgi388

avian3d: 0.6.

In Bevy's MeshPlugin it calls app.init_asset::<Mesh>().

But Avian never registers MeshPlugin itself.

This means that if you are, say, writing a user land unit test which installs Avian's PhysicsPlugins::default() (along with, say, MinimalPlugins and the user land plugin you are testing), then when the unit test runs, it will crash with:

thread 'tests::test_my test' (141545) panicked at /me/bevy/crates/bevy_ecs/src/error/handler.rs:125:1:
Encountered an error in system `avian3d::collision::collider::cache::clear_unused_colliders`: Parameter `MessageReader<'_, '_, AssetEvent<Mesh>>::messages` failed validation: Message not initialized
If this is an expected state, wrap the parameter in `Option<T>` and handle `None` when it happens, or wrap the parameter in `If<T>` to skip the system when it happens.

The options I see are:

  1. Add If to the system param.
  2. In ColliderCachePlugin, make it conditionally add MeshPlugin since it necessarily depends on it being registered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CollisionRelates to the broad phase, narrow phase, colliders, or other collision functionalityC-UsabilityA quality-of-life improvement that makes Avian easier to useP-CrashA sudden unexpected crashS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions