Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by DominoOne · Nov 27, 2010 at 09:40 PM · audiosoundplayoneshot

"PlayOneShot()" not working properly in Unity 3.1

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.

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jesse Anders · Nov 27, 2010 at 10:19 PM 0
Share

Are you calling PlayOneShot() on an audio source that's already playing another sound?

avatar image DominoOne · Nov 30, 2010 at 12:38 PM 0
Share

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?

avatar image XRA · Jan 02, 2011 at 07:35 AM 0
Share

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.

avatar image JGeorge · Jan 11, 2011 at 02:59 PM 0
Share

Having the same issue.

avatar image Carlsen · Feb 09, 2011 at 05:32 PM 0
Share

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)

Show more comments

6 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by JGeorge · Jan 11, 2011 at 03:34 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DominoOne · Jan 12, 2011 at 09:40 AM 0
Share

Well, those checkboxes are turned off, actually.. Although the audios are stereo. $$anonymous$$aybe I should force them to mono or something? However, I don't really get why that should help.

avatar image
0

Answer by Will 7 · Feb 04, 2011 at 05:12 PM

I am having the exact same problem. I have several different audio sources playing different sounds to try and remove the problem but it still arises. Have a look at my game here. Use the sequencer add lots of beats and bump the tempo up to 240bpm. Listen to the sound deteriorate. Same thing happens in the editor and on standalone executables. Anyone found a fix?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Mloren · Sep 30, 2011 at 01:44 PM

having the same problem on Unity 3.4

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by zzzzz4512 · Jun 06, 2012 at 12:34 PM

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by godoy · Nov 15, 2012 at 11:48 PM

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); } }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Making a sound play only once with a Boolean variable in javascript 1 Answer

Why will my audio not play in if statement? 2 Answers

Sound distorted on impact. 1 Answer

I need help about audio.PlayOneShot!! 1 Answer

How to stop an Audio Clip without an Audio Source? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges