Add ReflectComponent registration for Sprite (#8207)
# Objective - `Sprite` components are not included in scene (de)serialization. - Fixes #8206 ## Solution - Add `#[reflect(Component, Default)]` to `Sprite` - Add `#[derive(FromReflect)]` to `Sprite` and `Anchor` --------- Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
parent
aef643cf50
commit
9784186fc6
@ -1,9 +1,10 @@
|
||||
use bevy_ecs::component::Component;
|
||||
use bevy_ecs::{component::Component, reflect::ReflectComponent};
|
||||
use bevy_math::{Rect, Vec2};
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect};
|
||||
use bevy_render::color::Color;
|
||||
|
||||
#[derive(Component, Debug, Default, Clone, Reflect)]
|
||||
#[derive(Component, Debug, Default, Clone, Reflect, FromReflect)]
|
||||
#[reflect(Component, Default)]
|
||||
#[repr(C)]
|
||||
pub struct Sprite {
|
||||
/// The sprite's color tint
|
||||
@ -24,7 +25,7 @@ pub struct Sprite {
|
||||
|
||||
/// How a sprite is positioned relative to its [`Transform`](bevy_transform::components::Transform).
|
||||
/// It defaults to `Anchor::Center`.
|
||||
#[derive(Component, Debug, Clone, Default, Reflect)]
|
||||
#[derive(Component, Debug, Clone, Default, Reflect, FromReflect)]
|
||||
#[doc(alias = "pivot")]
|
||||
pub enum Anchor {
|
||||
#[default]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user