|
Hello, when I call PlayOneShot() pretty often, sometimes it doesn't play the sound. The thing is that I recently updated from Unity 2.6 to Unity 3.1 and I don't remember experiencing the problem in the older Unity, whereas Unity 3.1 seems to have it. Has anyone experienced a similar problem? Or maybe knows the cause or a solution? To give you some more info, when I want to play a sound, I always call a function (with an audio clip and an audio source specified as parameters), which is in an external script. That function checks, whether the audio is on or off (the variable is set in the PlayerPrefs), and if it's on, it then calls the native Unity PlayOneShot() function. Although, I have no idea how this could mess things up. Anyway, I would really appreciate it if you could help me somehow. Thanks in advance.
(comments are locked)
|
|
Just dealt with same problem. Not sure what causes but I made the same observation. It is related to I wrote a post about it if you want to check for more details and code examples.
(comments are locked)
|
|
using UnityEngine; using System.Collections; public class PortaoSaidaSomScript : MonoBehaviour { public bool tocar; public AudioClip PortaoAudio; // Use this for initialization void Start () { tocar = false; } void Update () { if (!tocar) { toca(); tocar=true; } } void toca() { audio.PlayOneShot(PortaoAudio); } }
(comments are locked)
|
|
having the same problem on Unity 3.4
(comments are locked)
|
|
Figured out what may be your problem. If you are doing a 2D game, make sure that all your audio files have the 3D Sound checkbox turned off. Well, those checkboxes are turned off, actually.. Although the audios are stereo. Maybe I should force them to mono or something? However, I don't really get why that should help.
Jan 12 '11 at 09:40 AM
DominoOne
(comments are locked)
|
|
You might want to check the priority of your sounds. I haven't played with it too much, but I know that depending on the priority's of the sounds playing Unity will cut some sounds out if there are too many playing at once. It's like when you have too many point lights in the scene, and depending on the quality level, Unity will stop rendering certain point lights to save on memory. yup, just looked it up: http://unity3d.com/support/documentation/ScriptReference/AudioSource-priority.html
(comments are locked)
|
1 2 next page »

Are you calling PlayOneShot() on an audio source that's already playing another sound?
Yes, the audio source is playing several sounds at a time. Is there a limit of how many sounds can be played at once or something?
I'm having the same problem, seems like a bug since I didn't have this issue in earlier versions of Unity. Some of my sounds won't even play at all.
Having the same issue.
Having the same issue. Has it been fixed? Will try updating to latest version, to see if it makes a difference. (havent updated for months)