License: MIT
space_editor is useful tool for scene/prefab/prototyping with bevy engine. Its allow to create/modify levels/scenes/prefabs in fast gui based way.
Aspires to be editor for bevy while there is no official editor.
Getting Started To run the editor, use the following command:
cargo run
To run platformer example, use the following command:
cargo run run --example platformer --features bevy_xpbd_3d
The following explains how to integrate space_editor
as a game plugin to use the created prefabs in your game.
Add this line to your Cargo.toml file
space_editor = "0.3.0"
To utilize the prefab spawn system, simply add the plugin to your application as follows:
App::default()
.add_plugins(DefaultPlugins)
.add_plugins(PrefabPlugin)
For spawning, use the PrefabBundle:
commands.spawn(PrefabBundle::new("tile.scn.ron"))
.insert(Name::new("Prefab"));
(More code at examples/spawn_prefab.rs)
The editor is a ready to use executable that can be used and altered at your own necessity. It's base configuration is as follows, with simple_editor_setup
:
fn main() {
App::default()
.add_plugins(DefaultPlugins)
.add_plugins(SpaceEditorPlugin::default())
.add_systems(Startup, simple_editor_setup)
.run();
}
(Code from main.rs)
editor
feature.More detailed information in docs/README.md
Custom types can be added to the editor gui and prefab spawn system with just a single line:
use editor::prelude::EditorRegistryExt;
app.editor_registry::<Name>();
The representation of components in the editor UI can also be customized by bevy_inspector_egui library.
Custom Events can be added to the editor UI with the following:
#[derive(Event, Default, Resource, Reflect, Clone)]
#[reflect(Resource)]
pub struct Name;
use editor::prelude::EditorRegistryExt;
app.editor_registry_event::<Name>();
One limitation is that events must implement Event, Default, Resource, Reflect, Clone
, with Resource
reflected. Once registered, events can be sent using the Event Dispatcher
tab.
Obs: editor already handles internally objects registration and initialization:
register_type::<T>() and init_resource::<T>()
To disable this, use feature
no_event_registration
.
A prefab is simply a Bevy scene serialized to a readable and editable RON format. However, it needs to be spawned through PrefabBundle to activate custom logic such as adding global transforms to an object.
More documentation can be found at the docs folder
Any request for adding functionality to the editor is welcome. Open an issue on the issue tracker. Any pull request is welcome too:)
MIT - https://choosealicense.com/licenses/mit/
I'm using the editor to create my own Sci-Fi space game, so the name of the project starts with space_ :)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。