Comments (9)
#12359 is much clearer to track: I'm going to close this out in favor of that issue.
from bevy.
I believe the audio entities by default don't get despawned. You can change the behavior to PlaybackMode::Despawn
on the audio bundle https://docs.rs/bevy/latest/bevy/audio/enum.PlaybackMode.html
from bevy.
I have already tried that. Here is the full code:
https://github.com/redstonerti/pong/
from bevy.
Nevermind, I hadn't set it in every instance that I spawned an AudioBundle. May I ask why it isn't Despawn by default?
from bevy.
Nevermind, I hadn't set it in every instance that I spawned an AudioBundle. May I ask why it isn't Despawn by default?
I think it's not the default because it creates very undesirable behavior when an AudioBundle
is attached to a normal entity with other data (i.e. it causes the entire entity to be destroyed when audio stops playing). (However, the default right now is also just very bad.)
from bevy.
It's possible that spawning audio as a component is not a good idea. Wouldn't it be better if it was a resource that could be accessed from anywhere, like Commands or something?
Maybe something like this?
AudioManager.play(source_file, AudioSettings{volume, pitch, Mode::Spatial3D(x,y,z)});
Although now that I think about it, it is really convenient how it is right now, because you can spawn AudioBundles along with enities and they can access and play them whenever they want, without having to necessarily know what they are playing. I could be picking up a rock or a stick for example, and they could be playing different audio with the same code, just by being spawned differently
from bevy.
How would you do spatial audio with a resource?
from bevy.
How would you do spatial audio with a resource?
I have no idea and no experience. I was just typing what I was thinking. Forget the spatial audio, I just thought it could be simpler to use a resource to play sounds.
from bevy.
See also #12359
from bevy.
Related Issues (20)
- Doing `#[reflect(ignore)]` on fields in a struct still requires `Default` on that field HOT 4
- `CubicCurve` is missing serde support
- Gamepad not giving back correct data when connected while app is running
- Incorrect WARN when using sub states HOT 5
- How to render a picture through the data of Vec<u8>
- Observe should state that `Trigger<_>` must be first arg HOT 1
- Simple gizmo usage might trigger vulkan validation errors HOT 4
- Add MainScheduleOrder::insert_before() HOT 3
- Cross gizmo HOT 2
- Extended material example fails in browser HOT 3
- [Bug?] State is not updated when manually updating App HOT 7
- Bevy needs a better asset-hosting solution for example assets HOT 15
- Audio latency is higher than it needs to be HOT 14
- `bevy_render::Frustum` should live in `bevy_math` HOT 5
- Audio Sink Creation Delayed and Multiple Sinks Spawned HOT 1
- Observers don't trigger for Sparse components HOT 1
- Main branch fails to compile on Rust beta: doc list item missing indentation HOT 3
- Change detection of keyboard's resource `ButtonInput` is inconsistent
- Rapid repeated animation transitions break animation HOT 4
- Explain the pros and cons of each anti-aliasing technique HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy.