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 /
  • Help Room /
avatar image
0
Question by ZaneM · Mar 05, 2021 at 07:21 PM · sound effects

Having trouble with playing a sound

I'm trying to get a sound effect to play when the player swings a sword. Following a Brackeys tutorial, I got an audio manager set up. When I swung the sword, the console reports that the proper functions were called and the sound was played, yet I didn't hear anything. The volume is maxed, it's set to 2d. I did everything I could find. So I did some investigating and recorded the game audio in audacity. Turning up the audio, I found out it was, in fact, playing sound every time I swung the sword, but it was a weird clicking sound, as if the audio stopped the second it got played. I have no idea why this is happening.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tylerdtrudeau · Mar 05, 2021 at 07:33 PM

I dont have alot of experience with sound stuff, but just to ask the obvious. Have you tried playing the sound clip somewhere else like say Windows Media Player to see if the sound file is working properly? Also have you tried downloading a different sound effect from somewhere like opengameart.org and trying that file to see if that one works?

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 ZaneM · Mar 05, 2021 at 07:43 PM 0
Share

I have, yes. The sound plays fine everywhere else, including the editor. It just doesn't work in-game. I went ahead and tried throwing a different sound on it, but that didn't work.

avatar image
0

Answer by ahmadgml32 · Mar 05, 2021 at 09:09 PM

u have 3 function for playing sound in unity 1- playing sound on awake without scripting from "play on awake" bool from audio source it self 2- AudioSource.Play(); which could be useful if playing sound just one or each period 3-ِfinally AudioSource.PlayOneShot(audioClipHere); this could be used for playing sound so fast like shooting weapons or something

now u have working sounds but it looks terrible when playing a lot so u can fix this using this simple line which randomly select pitch value

if if it didn't played at all go to edit/projectSetting/Audio/Disable Unity Audio make it false hope this works

 public float factor = 0.2f;
 public AudioSource audioSource;
 public AudioClip clip;

 private void Update()
 {
     audioSource.PlayOneShot(clip);
     //or use this AudioSource.PlayOneShot(clip, volume Value Here);
     float audioPitch = Random.Range(Time.timeScale, Time.timeScale + factor);
     audioSource.pitch = audioPitch;
 }
Comment
Add comment · Show 4 · 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 ahmadgml32 · Mar 05, 2021 at 09:20 PM 0
Share

if it didn't work yet increase global volume from audio setting like disable unity audio hope this fix your issues.

avatar image ZaneM · Mar 05, 2021 at 10:31 PM 0
Share

I not having trouble playing the sound, per say, the sound is technically playing. It's just messed up when played in-game. I've already made sure there wasn't any volume issues as well.

avatar image ahmadgml32 ZaneM · Mar 08, 2021 at 04:39 PM 0
Share

so audio stutters or what?? if it did just change doppler level from audio source what that does is sound changes depending on the distance between the audio listener and the audio source if it too close audio stutters

avatar image ahmadgml32 ZaneM · Mar 08, 2021 at 04:41 PM 0
Share

also If you speak arabic it is better to speak it to make it easier for you and me

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

156 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how create sound effect based on speed ? 0 Answers

Is there a way to check active audio snapshot 1 Answer

sound overlap, problems with character controller 0 Answers

How to make audio overlap itself? 1 Answer

How do i get my fu... sound to play when i die? Im a complete beginner heeelp ;) #pragmastrictforlife Thanks Alot 2 Answers


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