diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 331fe3d223..571413c8a8 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -25,7 +25,7 @@ use error::ScriptError; use event::ScriptCallbackEvent; use handler::{CallbackSettings, HandlerFn}; use runtime::{initialize_runtime, Runtime, RuntimeContainer, RuntimeInitializer, RuntimeSettings}; -use script::{ScriptId, Scripts, StaticScripts}; +use script::{ScriptComponent, ScriptId, Scripts, StaticScripts}; pub mod asset; pub mod bindings; @@ -326,6 +326,7 @@ fn register_types(app: &mut App) { app.register_type::(); app.register_type::(); app.register_type::(); + app.register_type::(); } /// Trait for adding a runtime initializer to an app diff --git a/crates/bevy_mod_scripting_core/src/script.rs b/crates/bevy_mod_scripting_core/src/script.rs index b616822834..64a93be8bd 100644 --- a/crates/bevy_mod_scripting_core/src/script.rs +++ b/crates/bevy_mod_scripting_core/src/script.rs @@ -1,6 +1,7 @@ //! Script related types, functions and components use crate::{asset::ScriptAsset, IntoScriptPluginParams}; +use bevy::prelude::ReflectComponent; use bevy::{asset::Handle, ecs::system::Resource, reflect::Reflect, utils::HashSet}; use parking_lot::Mutex; use std::{borrow::Cow, collections::HashMap, ops::Deref, sync::Arc}; @@ -11,7 +12,7 @@ use std::{borrow::Cow, collections::HashMap, ops::Deref, sync::Arc}; pub type ScriptId = Cow<'static, str>; #[derive(bevy::ecs::component::Component, Reflect, Clone)] - +#[reflect(Component)] /// A component which identifies the scripts existing on an entity. /// /// Event handlers search for components with this component to figure out which scripts to run and on which entities.