Remove unnecessary ResMut in examples (#10879)

# Objective

- Examples containing `ResMut`s that are never mutated can be confusing
for readers.

## Solution

- Changes them to `Res`.
This commit is contained in:
akimakinai 2023-12-06 00:42:32 +09:00 committed by GitHub
parent 9da65b10b4
commit f90248b052
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -30,7 +30,7 @@ fn load_textures(mut commands: Commands, asset_server: Res<AssetServer>) {
fn check_textures(
mut next_state: ResMut<NextState<AppState>>,
rpg_sprite_folder: ResMut<RpgSpriteFolder>,
rpg_sprite_folder: Res<RpgSpriteFolder>,
mut events: EventReader<AssetEvent<LoadedFolder>>,
) {
// Advance the `AppState` once all sprite handles have been loaded by the `AssetServer`

View file

@ -21,7 +21,7 @@ fn main() {
fn setup(
mut commands: Commands,
asset_server: ResMut<AssetServer>,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
) {

View file

@ -74,7 +74,7 @@ fn setup(mut state: ResMut<State>, asset_server: Res<AssetServer>) {
state.handle = asset_server.load("data/asset.custom");
}
fn print_on_load(mut state: ResMut<State>, custom_assets: ResMut<Assets<CustomAsset>>) {
fn print_on_load(mut state: ResMut<State>, custom_assets: Res<Assets<CustomAsset>>) {
let custom_asset = custom_assets.get(&state.handle);
if state.printed || custom_asset.is_none() {
return;

View file

@ -24,7 +24,7 @@ fn main() {
.run();
}
fn setup(mut commands: Commands, asset_server: ResMut<AssetServer>) {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
let text_style = TextStyle {