Giter Club home page Giter Club logo

Comments (9)

alice-i-cecile avatar alice-i-cecile commented on August 16, 2024 1

#12359 is much clearer to track: I'm going to close this out in favor of that issue.

from bevy.

hymm avatar hymm commented on August 16, 2024

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.

redstonerti avatar redstonerti commented on August 16, 2024

I have already tried that. Here is the full code:
https://github.com/redstonerti/pong/

from bevy.

redstonerti avatar redstonerti commented on August 16, 2024

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.

mweatherley avatar mweatherley commented on August 16, 2024

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.

redstonerti avatar redstonerti commented on August 16, 2024

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.

hymm avatar hymm commented on August 16, 2024

How would you do spatial audio with a resource?

from bevy.

redstonerti avatar redstonerti commented on August 16, 2024

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.

rparrett avatar rparrett commented on August 16, 2024

See also #12359

from bevy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.