Skip to content

Commit

Permalink
Fix bevy_hierarchy failing to compile without reflect feature (#1…
Browse files Browse the repository at this point in the history
…6428)

# Objective

Run this without this PR:
`cargo build -p bevy_hierarchy --no-default-features`

You'll get:
```
error[E0432]: unresolved import `bevy_reflect`
 --> crates/bevy_hierarchy/src/events.rs:2:5
  |
2 | use bevy_reflect::Reflect;
  |     ^^^^^^^^^^^^ use of undeclared crate or module `bevy_reflect`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `bevy_hierarchy` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
```

Because of this line:
```rs
use bevy_reflect::Reflect;

#[derive(Event, Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "reflect", derive(Reflect), reflect(Debug, PartialEq))]
pub enum HierarchyEvent { .. }
```

## Solution

use FQN: `derive(bevy_reflect::Reflect)`

## Testing

`cargo build -p bevy_hierarchy --no-default-features`
  • Loading branch information
aecsocket authored Nov 19, 2024
1 parent 1006a52 commit 81db6ec
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/bevy_hierarchy/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy_ecs::{event::Event, prelude::Entity};
#[cfg(feature = "reflect")]
use bevy_reflect::Reflect;

/// An [`Event`] that is fired whenever there is a change in the world's hierarchy.
Expand Down

0 comments on commit 81db6ec

Please sign in to comment.