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
0
Question by inglipX · Mar 29, 2013 at 09:05 PM · audioissue

PLEASE Help me with this Audio Issue

How can i get it so that when i have vertical and horizontal movement i play an audio clip.

I have this as my script but the audio is distorted and messed up. What's wrong?

 var walkAudio : AudioClip;
 var isMoving : boolean = false;
 
 
 
 
 function Update() {
 
     if (Input.GetAxis("Horizontal") || Input.GetAxis("Vertical") )
     
     isMoving = true;
     audio.PlayOneShot(walkAudio);
 }
         
Comment
Add comment · Show 1
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 Loius · Mar 30, 2013 at 12:08 AM 0
Share

That code doesn't distort audio. Have you checked the import settings on the audio file? Is your bitrate correct?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by psycocrusher · Mar 29, 2013 at 09:13 PM

I suggest you put all your audio under one parent group, and then you just call the sound you need.

gameObject.Find("YourAudio").audio.Play();

Comment
Add comment · Show 6 · 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 inglipX · Mar 29, 2013 at 09:17 PM 0
Share

ughh what do you meaan.. like have a parent game object then few game objects as children in it with their own sounds??

avatar image psycocrusher · Mar 29, 2013 at 09:29 PM 0
Share

yes, each with their own audio source, or else you will end up with audio all over the place. It's fine for small projects only.

avatar image inglipX · Mar 29, 2013 at 09:37 PM 0
Share

it does not work.....

avatar image psycocrusher · Mar 29, 2013 at 09:45 PM 0
Share

create an empty gameObject, put an audio source on it. drag your audio file in the audio source.

Then call it:

gameObject.Find("YourAudio").audio.Play();

avatar image inglipX · Mar 29, 2013 at 11:46 PM 0
Share

does not do anything

Show more comments

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

12 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

Related Questions

Multiple Cars not working 1 Answer

Audio on Collision code doesn't work? 2 Answers

Change Music When GameObject is Grabbed? 1 Answer

Stuck on this! Please help me out. 1 Answer

Audio on collision is not working? 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