Skip to content

Commit 6ab2b07

Browse files
authored
Make it easier to opt out of bevy_audio (bevyengine#23126)
# Objective - bevy_seedling is incompatible with `bevy_audio` - all our profile features (`3d`, `2d`, `ui`) enable the `audio` collection feature - That means that a seedling user needs to do this to land at the current `default`: ```toml [dependencies] bevy = { version = "0.18.0", default-features = false, features = [ # 2d "2d_bevy_render", "default_app", "picking", "scene", # 3d "3d_bevy_render", # ui "ui_api", "ui_bevy_render", # default_platform "android-game-activity", "bevy_gilrs", "bevy_winit", "default_font", "multi_threaded", "std", "sysinfo_plugin", "wayland", "webgl2", "x11", ] } ``` ## Solution - Disable the `audio` collection features for all profile features and instead enable it by default - The new seedling config now looks like this: ```toml [dependencies] bevy = { version = "0.18.0", default-features = false, features = [ "2d", "3d", "ui", ] } ``` ## Testing - None, CI should take care of this
1 parent 1b0f112 commit 6ab2b07

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ unsafe_op_in_unsafe_fn = "warn"
131131
unused_qualifications = "warn"
132132

133133
[features]
134-
default = ["2d", "3d", "ui"]
134+
default = ["2d", "3d", "ui", "audio"]
135135

136136
# PROFILE: The default 2D Bevy experience. This includes the core Bevy framework, 2D functionality, Bevy UI, scenes, audio, and picking.
137137
2d = [
@@ -140,7 +140,6 @@ default = ["2d", "3d", "ui"]
140140
"2d_bevy_render",
141141
"ui",
142142
"scene",
143-
"audio",
144143
"picking",
145144
]
146145

@@ -151,7 +150,6 @@ default = ["2d", "3d", "ui"]
151150
"3d_bevy_render",
152151
"ui",
153152
"scene",
154-
"audio",
155153
"picking",
156154
]
157155

@@ -162,7 +160,6 @@ ui = [
162160
"ui_api",
163161
"ui_bevy_render",
164162
"scene",
165-
"audio",
166163
"picking",
167164
"bevy_ui_widgets",
168165
]

docs/cargo_features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bevy = { version = "0.18", default-features = false, features = ["2d"] }
2121

2222
|Profile|Description|
2323
|-|-|
24-
|default|The full default Bevy experience. This is a combination of the following profiles: 2d, 3d, ui|
24+
|default|The full default Bevy experience. This is a combination of the following profiles: 2d, 3d, ui, audio|
2525
|2d|The default 2D Bevy experience. This includes the core Bevy framework, 2D functionality, Bevy UI, scenes, audio, and picking.|
2626
|3d|The default 3D Bevy experience. This includes the core Bevy framework, 3D functionality, Bevy UI, scenes, audio, and picking.|
2727
|ui|The default Bevy UI experience. This includes the core Bevy framework, Bevy UI, scenes, audio, and picking.|
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "`audio` feature is now no longer implied by the `3d`, `2d`, or `ui` features"
3+
pull_requests: [23126]
4+
---
5+
6+
Our `default` features used to be
7+
8+
- 2d
9+
- 3d
10+
- ui
11+
12+
where each of these features enabled the `audio` feature among others.
13+
14+
Since Cargo doesn't allow selectively disabling features, if you wished to disable `bevy_audio`, either because you don't need audio or because you use an alternative such as bevy_seedling, you had a problem with that.
15+
You needed to essentially enable all features enabled by the above *except* `audio`, leading to a big `features` soup. To avoid this,
16+
`audio` is now no longer enabled by the above features, but instead enabled by default, bumping our default features to:
17+
18+
- 2d
19+
- 3d
20+
- ui
21+
- audio
22+
23+
Now what does this mean for you?
24+
25+
- If you used all default features before, nothing changes for you.
26+
- If you want to opt out of using `bevy_audio`, it is now as simple as disabling default features, and manually opting into `3d`, `2d`, and/or `ui`.
27+
- If you already opted into non-default features and want to continue using `bevy_audio`, you will now have to add the `audio` feature.

0 commit comments

Comments
 (0)