Skip to content

Commit d0ec280

Browse files
committed
called register_type for ScriptComponent, added #[reflect(Component)]
1 parent 996cfba commit d0ec280

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/bevy_mod_scripting_core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use error::ScriptError;
2525
use event::ScriptCallbackEvent;
2626
use handler::{CallbackSettings, HandlerFn};
2727
use runtime::{initialize_runtime, Runtime, RuntimeContainer, RuntimeInitializer, RuntimeSettings};
28-
use script::{ScriptId, Scripts, StaticScripts};
28+
use script::{ScriptComponent, ScriptId, Scripts, StaticScripts};
2929

3030
pub mod asset;
3131
pub mod bindings;
@@ -326,6 +326,7 @@ fn register_types(app: &mut App) {
326326
app.register_type::<ScriptValue>();
327327
app.register_type::<ScriptTypeRegistration>();
328328
app.register_type::<ReflectReference>();
329+
app.register_type::<ScriptComponent>();
329330
}
330331

331332
/// Trait for adding a runtime initializer to an app

crates/bevy_mod_scripting_core/src/script.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Script related types, functions and components
22
33
use crate::{asset::ScriptAsset, IntoScriptPluginParams};
4+
use bevy::prelude::ReflectComponent;
45
use bevy::{asset::Handle, ecs::system::Resource, reflect::Reflect, utils::HashSet};
56
use parking_lot::Mutex;
67
use std::{borrow::Cow, collections::HashMap, ops::Deref, sync::Arc};
@@ -11,7 +12,7 @@ use std::{borrow::Cow, collections::HashMap, ops::Deref, sync::Arc};
1112
pub type ScriptId = Cow<'static, str>;
1213

1314
#[derive(bevy::ecs::component::Component, Reflect, Clone)]
14-
15+
#[reflect(Component)]
1516
/// A component which identifies the scripts existing on an entity.
1617
///
1718
/// Event handlers search for components with this component to figure out which scripts to run and on which entities.

0 commit comments

Comments
 (0)