| Crates.io | bevy_registration |
| lib.rs | bevy_registration |
| version | 0.2.4 |
| created_at | 2025-01-06 02:48:09.859618+00 |
| updated_at | 2025-01-29 23:04:41.546039+00 |
| description | Run code on the app from far away. |
| homepage | |
| repository | https://github.com/coolcatcoder/bevy_registration |
| max_upload_size | |
| id | 1505256 |
| size | 60,280 |
Annotate systems, resources, and events with macros and automatically add them to your app. This uses Inventory internally, so it may not work on all targets.
| registration version | bevy version |
|---|---|
| 0.1.0 - 0.2.3 | 0.15 |
use bevy::prelude::*;
use bevy_registration::prelude::*;
// Initiates the resource on the app.
#[init]
#[derive(Resource, Default)]
pub struct TestResource;
// Adds the system to the Update schedule.
#[system(Update)]
fn resource_tester(resource: Option<Res<TestResource>>) {
// This will not panic.
resource.unwrap();
}
fn main() {
App::new()
// Add bevy's default plugins, to start up the update loop.
.add_plugins(DefaultPlugins)
// Add the registration plugin that will collect the far-away app code.
.add_plugins(RegistrationPlugin)
.run();
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.