Crate bevy_proto
source ·Expand description
Define and spawn entities with simple configuration files.
Capabilities
- Define entities in configuration files called prototypes
- Inherit from other prototype files
- Establish entity hierarchies
- Load or preload assets
This is all built on a backend crate called bevy_proto_backend
.
If you want to define your own prototype schema,
feel free to use that crate directly!
Example
Prototypes can be defined using a RON file ending in .prototype.ron
:
// Player.prototype.ron
(
name: "Player",
schematics: {
"bevy_proto::custom::SpriteBundle": (
texture: AssetPath("textures/player.png"),
),
}
)
Then they can be loaded and spawned from any system:
use bevy_proto::prelude::*;
fn load_player(mut prototypes: PrototypesMut) {
prototypes.load("prototypes/Player.prototype.ron");
}
fn spawn_player(mut commands: ProtoCommands) {
commands.spawn("Player");
}
Cargo Features
Feature | Default | Description |
---|---|---|
auto_name | ✅ | Automatically insert Name components on spawned prototypes |
custom_schematics | ✅ | Enables some custom schematics defined by this crate |
ron | ✅ | Enables RON deserialization |
yaml | ❌ | Enables YAML deserialization |
bevy_animation | ✅ | Registers types under Bevy’s bevy_animation feature |
bevy_audio | ✅ | Registers types under Bevy’s bevy_audio feature |
bevy_gltf | ✅ | Registers types under Bevy’s bevy_gltf feature |
bevy_pbr | ✅ | Registers types under Bevy’s bevy_pbr feature |
bevy_render | ✅ | Registers types under Bevy’s bevy_render feature |
bevy_scene | ✅ | Registers types under Bevy’s bevy_scene feature |
bevy_sprite | ✅ | Registers types under Bevy’s bevy_sprite feature |
bevy_text | ✅ | Registers types under Bevy’s bevy_text feature |
Modules
- Provides access to the backend crate that
bevy_proto
is built on. - Configuration for prototypes.
- A collection of custom schematics (requires the
custom_schematics
feature). - Type aliases for common config hooks.
- Provides the basics needed to use this crate.
- Items relating to the main
Prototype
struct.