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)
- Rename `EntityCommands::add` to `EntityCommands::queue` HOT 7
- Fix calculation of borders in UI material extraction
- Main branch fails to compile on Rust beta. HOT 1
- Welcome new contributors workflow is failing
- Entities with multiple observers do not function correctly HOT 2
- Make `ReflectCommandExt` work with bundles
- Remove `NextState` in favor of `commands.set_state` HOT 7
- Add a `TimedCommands` `SystemParam` for easier delayed operations HOT 5
- Add support for letterboxing HOT 4
- Remove `StateTransition` schedule in favor of using observers HOT 5
- different wgpu_backend render total different with the same gltf model HOT 4
- When using multiple canvas, an error is displayed
- Implement `Component` for `Arc` HOT 5
- Border radius is scaled incorrectly HOT 2
- non-root `TargetCamera`s are not ignored HOT 1
- Resource doesn't get dropped on panic in system. Is this expected? HOT 4
- uberbuffers selects single mesh when two are added HOT 1
- Instance example magically inherits transform information of a random entity if any number of new pbr bundles is spawned HOT 3
- ImageAddressMode::Repeat "twitchy" texture rendering
- overflow evaluating the requirement &_: IntoIterator 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.