I’m using AudioSource.Play(), with 2D sound, and get a strange echo. The original file doesn’t sound like this.
Do you have multiple audio sources?
Do you have exactly one AudioListener in your scene?
If you select the sound asset in Unity’s project view and play the preview, does that sound correct?
Have you changed any relevant-looking settings on your AudioSource to something other than default?
Probably not related to your problem, but note that sound effects often want to be played using PlayOneShot() rather than Play().
Thank you, I closed unity, I’ll try tomorrow. It is late night on my time zone
I think I have 4 cameras and I forgot to remove the audio listener for 3 of them
I tried removing all audio listeners and let 1, I tried changing audio source settings, when I play the audio in editor, sound normal, but in game still sound like echo
You got a reverb zone?
check the mixer
I think I have no mixer applied on that audio source
Check this video: bwk2ux
I recorded how the audio actualy sounds in game and how it should sound
I want to say that when I use AudioSource.PlayClipAt(Vector3) as a static method reference it works, but in this case I want to use audioSource.Play(AudioClip) as a non-static reference because PlayClipAt uses 3d sound and I don’t need that in this case
Where is the AudioSource in your scene? For position-independent sounds, I usually attach the AudioSource to the same GameObject as the AudioListener (usually the camera).
On older forums someone said that if you play an audio in OnTriggerEnter and the objects has more than 1 colliders it is played once for every collider. It is true that I have more colliders on the object, but only one mesh collider and I checked like that:
void OnTriggerEnter(Collider other){
if(other is MeshCollider){
treeHealth--;
AudioSource.PlayOneShot();
}
}
It is on the FPSController the parent of the camera. I’ll try to move it to the camera
That’s embarrassing, I just found that camera had “Audio Reverb Filter” component
Called it, haha
When I first read you message I checked the mixers, I didn’t know reverb can be a component, I don’t even know how it came to be applied to the camera
Aaah, I love software and debugging!!! Timeless.
Me neither! TIL… thanks!
Also,
Sometimes I think it isn’t working because of something, I disable that thing, still not working, disable one more thing, still not working, and then I realize why it isn’t actually working and I have to re-enable/re-write things that actually worked…
That’s the beauty of working with source control like git: you can rip-tear-shred your way through the codebase doing as much damage as you want when you are tracking something down, utterly ransacking and wrecking everything in your path in your quest for knowledge.
Once you actually find the thing that was causing the problem, fix that one thing, commit it, then revert everything else with one button click. If you can’t find it, revert and restart down another path.
It’s especially useful on massive projects, such as when you have a device-only crash, and your build process takes 10 minutes and makes a massive binary: just select all textures and set their import size as small as possible (32x32 pixels for instance), then suddenly your build process is a lot faster. When the problem is fixed, REVERT!
Related to the image, I’m a person who rages very often(Maybe because I played a lot of online games in my childhood)
I am code raging a lot, screaming at my computer. I raged 1 week ago when I tried to create a virtual 3d space in OpenGL using Java(LWJGL) just for testing, it is a lot easier to use a game engine. There are very few tutorials for java+opengl so I had to follow a c++ tutorial and they had a math library for view/perspective matrices called glm but lwjgl doesn’t so I had to write my own math library for matrices, vector3, vector2, vector4 matrices multiplication, vector-matrix multiplication. That was very idiot and pointless. I think I lost 3 years of life because of this. I didn’t gave up because I couldn’t. I finally succeed and now I can fly trough a world with a Suzane monkey in the center. I closed that project and never open again because I don’t want to try create a game without engine plus I don’t want to shorten my life that much. The moral of the story is: Stop raging at multiplayer games or coding if you don’t want to live fewer years than 50 years. I googled it and code raging is actually a thing there are a lot of people who curse the computer.