- Home /
Trigger Sound to Play Globally Not on Triggered Object
Hello
I feel a little silly posting the same script here. But I'm lost trying to add multiple functionality to it I don't understand, and don't want to link people to the other post just to see the script.
So, I have this script:
public class SoundOnTrigger : MonoBehaviour {
public AudioCollection sounds;
void OnTriggerEnter(Collider other) {
if(other.tag != "Player")
return;
if(this.audio != null) {
sounds.PlayNext(this.audio);
}
else {
sounds.PlayNext(other.audio);
}
}
}
The problem with it is that it plays the sound on whatever object the trigger comes from. I need the sound to stay with the player and not sound like it's come from a 3D space. Think like a narrator in the scene. Or if the main character was talking at certain points while the player is triggering scripts. If the sound sounds like it's coming from a spot in the room the player can walk away from, it doesn't work. Games that are a great example of what I'm trying to do are Dear Esther and The Stanley Parable.
Thank you for your time! I understand everyone has a life! It means a lot even when I see this thread has views. Looking forward to any insight anyone has. Thanks!
Answer by MousePods · Mar 20, 2014 at 02:48 AM
Uncheck 3D sound in the sound's options!
Hope this helps =]
Yes thank you! Also I feel a little stupid having asked this in the first place! Sometimes I way over think things. I often forget how simple some things in Unity are. I also noticed if I reverse the distance in the rolloff settings it achieves what I am going for. Although I have yet to walk really far away from the trigger. However I think coupling that with unchecking 3D sound will be perfect. Thank you so much!
No problem, I do the exact same thing! ^_^
Could you accept the answer xD?
Again I feel so lame. How do you accept an answer? I apparently haven't been doing that here. :O Do I just click the little green check mark? If so I've done that....