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 /
This question was closed Jun 11, 2013 at 08:00 PM by Graham-Dunnett for the following reason:

Duplicate Question

avatar image
0
Question by FrreStuff · Jun 10, 2013 at 08:24 PM · audio

Audio Script doesn't work

Hi everyone! so i have this script which i want to play a sound trough all scenes expect for 1 particular scene that is called BehindLocks. After i apply my script to an empty gameObject and add sound to the gameObject and after i start my game the script doesn't seem to work for some reason. the music plays trough out all of the scenes and doesn't stop when i am at the BehindLocks scene. Before i startup my game i have no errors and everything seems to look just fine. Could anyone please help me out?

this is my script

function Awake () { DontDestroyOnLoad (transform.gameObject); if( Application.loadedLevelName == "BehindLocks" ) audio.Stop(); }

Comment
Comments Locked · Show 3
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 DaveA · Jun 10, 2013 at 08:25 PM 0
Share

Please edit and format your code. didn't you ask this yesterday? if so, you should be modifying that post, not starting a new one.

avatar image DaveA · Jun 10, 2013 at 08:26 PM 0
Share

Is the AudioSource on the same object that this script is on? I'm not sure if Awake is the place to check for audio playing anyway, you might want that in Update.

avatar image FrreStuff · Jun 10, 2013 at 08:46 PM 0
Share

I was replying to the comments but no one commented back so i decided to create a new post. And yes the AudioSource is on the same object as the script is , i also changed the Awake function to Update but it still doesn't work when in enter the scene the audio keeps playing for some reason.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Audio Problem 0 Answers

Why my sound it's not attaching to my Flashlight 2 Answers

one shot Sound on collision. Unity 4.0 problem. 2 Answers

How to play an audio one shot clip on a collision 1 Answer

Audio Help! 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