bevy_scene/
components.rs

1use bevy_asset::Handle;
2use bevy_derive::{Deref, DerefMut};
3use bevy_ecs::{component::Component, prelude::ReflectComponent};
4use bevy_reflect::{prelude::ReflectDefault, Reflect};
5use bevy_transform::components::Transform;
6use derive_more::derive::From;
7
8use bevy_camera::visibility::Visibility;
9
10use crate::{DynamicScene, Scene};
11
12/// Adding this component will spawn the scene as a child of that entity.
13/// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component.
14#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
15#[reflect(Component, Default, Debug, PartialEq, Clone)]
16#[require(Transform)]
17#[require(Visibility)]
18pub struct SceneRoot(pub Handle<Scene>);
19
20/// Adding this component will spawn the scene as a child of that entity.
21/// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component.
22#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
23#[reflect(Component, Default, Debug, PartialEq, Clone)]
24#[require(Transform)]
25#[require(Visibility)]
26pub struct DynamicSceneRoot(pub Handle<DynamicScene>);