Skip to content

Commit

Permalink
Fixes Camera not being serializable due to missing registrations in c…
Browse files Browse the repository at this point in the history
…ore functionality. (bevyengine#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes bevyengine#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 bevyengine#6169



Co-authored-by: Noah <noahshomette@gmail.com>
  • Loading branch information
2 people authored and james7132 committed Oct 28, 2022
1 parent 3c8c528 commit 7b93442
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub mod prelude {

use bevy_app::prelude::*;
use bevy_ecs::entity::Entity;
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
use bevy_utils::{Duration, HashSet, Instant};
use std::borrow::Cow;
use std::ops::Range;
Expand All @@ -34,7 +35,11 @@ impl Plugin for CorePlugin {
.unwrap_or_default()
.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_math_types(app);
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_render/src/camera/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl Plugin for CameraPlugin {
fn build(&self, app: &mut App) {
app.register_type::<Camera>()
.register_type::<Viewport>()
.register_type::<Option<Viewport>>()
.register_type::<Visibility>()
.register_type::<ComputedVisibility>()
.register_type::<VisibleEntities>()
Expand Down

0 comments on commit 7b93442

Please sign in to comment.