Skip to main content

Crate bevy_map_derive

Crate bevy_map_derive 

Source
Expand description

Derive macros for bevy_map_editor entity spawning

This crate provides the #[derive(MapEntity)] macro for automatically implementing entity spawning from map data.

§Example

use bevy::prelude::*;
use bevy_map_derive::MapEntity;

#[derive(Component, MapEntity)]
#[map_entity(type_name = "NPC")]
pub struct Npc {
    #[map_prop]
    pub name: String,
    #[map_prop(default = 100)]
    pub health: i32,
    #[map_sprite("sprite")]  // Optional: receives sprite handle when loaded
    pub sprite_handle: Option<Handle<Image>>,
}

Derive Macros§

MapEntity
Derive macro for creating map entities that can be spawned from EntityInstance data