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 Iamthelifefish · Jul 28, 2013 at 05:52 AM · audio

Audio Help!

I am currently making a horror game, and I need sounds to play once, and then destroy, I asked this earlier, but I couldnt find the thread, this is my script

 function OnTriggerEnter(other: Collider){
 
   if (!audio.isPlaying){
   
  audio.Play();
  Destroy.audio();
   }
 }
    

I did not make this script. If this script is not right, please reply with a solution :)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by daivd.ramz · Jul 28, 2013 at 07:08 AM

hi, do you want to play sound for next? and you must check your AudioSource, state loop in audiosource must be off and you can this work too

     function OnTriggerEnter(other: Collider){
      
     if (!audio.isPlaying && allow_play){
     
     audio.loop = false; 
     audio.Play();
     allow_play = false;
     
     }
     }

and if you want to play for next you can this work:

     function OnTriggerExit(other: Collider){
 
     if (!audio.isPlaying && !allow_play){
  
        allow_play = true;
 
     }

and for end can you explain more,maybe i can help you, please and excuse me for my bad english :)

Comment
Add comment · Show 5 · 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 Iamthelifefish · Jul 28, 2013 at 07:23 AM 0
Share

Sorry, but neither of these worked, I have a feeling, that I might be putting the script in the wrong Javascript file, i'm putting it in the soundscript with had my script I have gotten about 3 other answers, and none of them worked, am I doing this right?. (I'm a Newbie) :(

avatar image daivd.ramz · Jul 28, 2013 at 07:40 AM 0
Share

can you send to me your javascript file? you can send it to my gmail: davood.ramz@gmail.com

avatar image Iamthelifefish · Jul 28, 2013 at 07:44 AM 0
Share

Okay, sent :).

avatar image daivd.ramz · Jul 28, 2013 at 07:50 AM 0
Share

can you chat with me in gmail?

avatar image daivd.ramz · Jul 28, 2013 at 08:07 AM 0
Share

i send you a mail :)

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

17 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

Related Questions

How to play several audio cllips one after another. 3 Answers

Slowly fade audio's pitch on key press? 3 Answers

Audio after Audio Loop 1 Answer

Play audio on keyboard click? 1 Answer

Pausing and playing audio on key press? 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