[][src]Crate amethyst_editor_sync

Provides functionality that allows an Amethyst game to communicate with an editor.

SyncEditorSystem is the root system that will send your game's state data to an editor. In order to visualize your game's state in an editor, you'll also need to create a [ReadComponentSystem] or [ReadResourceSystem] for each component and resource that you want to visualize. It is possible to automatically create these systems by creating a SyncEditorBundle and registering each component and resource on it instead.


extern crate amethyst;
extern crate amethyst_editor_sync;
extern crate serde;

use amethyst::core::Transform;
use amethyst::ecs::*;
use amethyst::prelude::*;
use amethyst_editor_sync::*;

// Specify every component that you want to view in the editor.
let components = type_set![MyComponent];

// Do the same for your resources.
let resources = type_set![MyResource];

// Read-only resources (i.e. that don't implement `DeserializeOwned`) can still
// be displayed in the editor, but they can't be edited.
let read_only_resources = type_set![ReadOnlyResource];

// Create a SyncEditorBundle which will create all necessary systems to send the components
// to the editor.
let editor_sync_bundle = SyncEditorBundle::new()
    // Register the default types from the engine.
    // Register the components and resources specified above.

let game_data = GameDataBuilder::default()

// Make sure you enable serialization for your custom components and resources!
#[derive(Serialize, Deserialize)]
struct MyComponent {
    foo: usize,
    bar: String,

impl Component for MyComponent {
    type Storage = DenseVecStorage<Self>;

#[derive(Serialize, Deserialize)]
struct MyResource {
    baz: usize,

struct ReadOnlyResource {
    important_entity: SerializableEntity,


First, specify the components and resources that you want to see in the editor using the type_set! macro. Then create a SyncEditorBundle object and register the specified components and resources with sync_components and sync_resources respectively. Some of the engine-specific types can be registered automatically using the sync_default_types method. It is also possible to specify the types individually using sync_component and sync_resource, which allows changing the name of the type when viewed in the editor.

Finally, add the SyncEditorBundle that you created to the game data.



Create a set of types, where the value is the stringified typename.



A connection to an editor which allows sending messages via a SyncEditorSystem.


A Log implementation that sends all incoming logs to the editor, which may allow more interactive filtering.


Helper type that wraps an Entity to provide serialization support.


Bundles all necessary systems for serializing all registered components and resources and sending them to the editor.


A system that is in charge of coordinating a number of serialization systems and sending their results to the editor.


A set of types with associated data.



Messages sent from the editor to the game.



A type that groups component types.


A type that groups resource types.