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

FeatureDefaultDescription
auto_nameAutomatically insert Name components on spawned prototypes
custom_schematicsEnables some custom schematics defined by this crate
ronEnables RON deserialization
yamlEnables YAML deserialization
bevy_animationRegisters types under Bevy’s bevy_animation feature
bevy_audioRegisters types under Bevy’s bevy_audio feature
bevy_gltfRegisters types under Bevy’s bevy_gltf feature
bevy_pbrRegisters types under Bevy’s bevy_pbr feature
bevy_renderRegisters types under Bevy’s bevy_render feature
bevy_sceneRegisters types under Bevy’s bevy_scene feature
bevy_spriteRegisters types under Bevy’s bevy_sprite feature
bevy_textRegisters types under Bevy’s bevy_text feature

Modules