bevy/crates/bevy_app/src
Doonv ba0f8f996f
Add insert_state to App. (#11043)
# Objective

Fix #10731.

## Solution

Rename `App::add_state<T>(&mut self)` to `init_state`, and add
`App::insert_state<T>(&mut self, state: T)`. I decided on these names
because they are more similar to `init_resource` and `insert_resource`.

I also removed the `States` trait's requirement for `Default`. Instead,
`init_state` requires `FromWorld`.

---

## Changelog

- Renamed `App::add_state` to `init_state`.
- Added `App::insert_state`.
- Removed the `States` trait's requirement for `Default`.

## Migration Guide

- Renamed `App::add_state` to `init_state`.
2023-12-21 14:09:24 +00:00
..
app.rs Add insert_state to App. (#11043) 2023-12-21 14:09:24 +00:00
ci_testing.rs Take example screenshots in CI (#8488) 2023-05-01 18:00:01 +00:00
lib.rs Add First/Pre/Post/Last schedules to the Fixed timestep (#10977) 2023-12-14 04:35:40 +00:00
main_schedule.rs Add First/Pre/Post/Last schedules to the Fixed timestep (#10977) 2023-12-14 04:35:40 +00:00
plugin_group.rs Add track_caller to App::add_plugins (#9174) 2023-07-23 01:02:20 +00:00
plugin.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
schedule_runner.rs Revert App::run() behavior/Remove winit specific code from bevy_app (#10389) 2023-11-16 21:50:17 +00:00