Fixes Camera not being serializable due to missing registrations in core functionality. (#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes #6169

## Solution

- Updated Bevy_Render CameraPlugin with registrations for Option<Viewport> and then Bevy_Core CorePlugin with registrations for ReflectSerialize and ReflectDeserialize for type data Range<f32> respectively according to the solution in #6169



Co-authored-by: Noah <noahshomette@gmail.com>
This commit is contained in:
Noah 2022-10-10 16:34:22 +00:00
parent 3321d68a75
commit 6ae46f6403
2 changed files with 7 additions and 1 deletions

View file

@ -17,6 +17,7 @@ pub mod prelude {
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_ecs::entity::Entity; use bevy_ecs::entity::Entity;
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
use bevy_utils::{Duration, HashSet, Instant}; use bevy_utils::{Duration, HashSet, Instant};
use std::borrow::Cow; use std::borrow::Cow;
use std::ops::Range; use std::ops::Range;
@ -34,7 +35,11 @@ impl Plugin for CorePlugin {
.unwrap_or_default() .unwrap_or_default()
.create_default_pools(); .create_default_pools();
app.register_type::<Entity>().register_type::<Name>(); app.register_type::<Entity>()
.register_type::<Name>()
.register_type::<Range<f32>>()
.register_type_data::<Range<f32>, ReflectSerialize>()
.register_type_data::<Range<f32>, ReflectDeserialize>();
register_rust_types(app); register_rust_types(app);
register_math_types(app); register_math_types(app);

View file

@ -22,6 +22,7 @@ impl Plugin for CameraPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.register_type::<Camera>() app.register_type::<Camera>()
.register_type::<Viewport>() .register_type::<Viewport>()
.register_type::<Option<Viewport>>()
.register_type::<Visibility>() .register_type::<Visibility>()
.register_type::<ComputedVisibility>() .register_type::<ComputedVisibility>()
.register_type::<VisibleEntities>() .register_type::<VisibleEntities>()