bevy/crates/bevy_scene/src
Hennadii Chernyshchyk 1da6720132 Add apply_or_insert functions to reflected component and resources (#5201)
# Objective

`ReflectResource` and `ReflectComponent` will panic on `apply` method if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first.

## Solution

* Add `ReflectComponent::apply_or_insert` and `ReflectResource::apply_or_insert` functions.
* Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency.

---

## Changelog

### Added

* `ReflectResource::apply_or_insert` and `ReflectComponent::apply_on_insert`.

### Changed

* Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency.
* Use `ReflectComponent::apply_on_insert` in `DynamicScene` instead of manual checking.

## Migration Guide

* Rename `ReflectComponent::add` into `ReflectComponent::insert`.
2022-07-11 14:11:24 +00:00
..
bundle.rs add a SceneBundle to spawn a scene (#2424) 2022-06-09 20:34:09 +00:00
dynamic_scene.rs Add apply_or_insert functions to reflected component and resources (#5201) 2022-07-11 14:11:24 +00:00
lib.rs add a SceneBundle to spawn a scene (#2424) 2022-06-09 20:34:09 +00:00
scene_loader.rs Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
scene_spawner.rs remove component and resource suffixes from reflect structs (#5219) 2022-07-06 02:59:51 +00:00
scene.rs add a SceneBundle to spawn a scene (#2424) 2022-06-09 20:34:09 +00:00
serde.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00