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
1
Question by craz3sl3nd3rfan · Jul 08, 2014 at 04:01 PM · audioloadlevelswitch scenes

How to Make the Game Go to the Next Level When the Music Stops

I am trying to make a intro to a Sonic.exe like game I'm working on, but I dont know how to make the game go to the next scene when the music stops, if you guys can help me, It would be great! BTW: I don't have unity Pro -_-

Comment
Add comment · Show 2
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 Nerevar · Jul 09, 2014 at 09:23 AM 2
Share

Hello

You need a flag to time the end of the audioclip

something like this :

    public AudioClip introClip;
 
     
     void Start () {
         audio.clip = introClip;
         audio.Play();
         StartCoroutine("IntroEnding");
     }
 
 
     IEnumerator IntroEnding(){
 
         yield return new WaitForSeconds(introClip.length);
             Application.LoadLevel("...");
 
     }


cheers

avatar image craz3sl3nd3rfan Nerevar · Oct 16, 2015 at 07:32 PM 0
Share

is it c# or javascript?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ahgr123 · Jul 08, 2014 at 05:03 PM

Look in the application class, it offers some scene loading functions:

http://unity3d.com/support/documentation/ScriptReference/Application.html

for example Application.LoadLevel();

http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.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 JusticeAShearing · Jul 08, 2014 at 05:05 PM

I have two ways that could help you. It is one, or the other, due to whichever circumstances arise.

First One:

This depends on the idea that you have a script which activates the sound. If that is so, apply this code to the script. I do hope that it works for you. If it doesn't, or you would like the gaps filled in, please post the full script that activates the sound.

This script is written in Java-Script. If you want it in another language, tell me and I will try to translate it.

 //This code is applied at the end
 
 function OnMusicStop () 
 {
     Application.LoadLevel("the level that you want to load")
 }
 
 //This code is applied within the function that plays the music, so that when the music stops, this occurs
 
 OnMusicStop();

If there is no script, please further explain the specific circumstances.

Please post your script if there is one, so I can give it to you with my additions in it.

Replace 'the level that you want to load' with the number assigned to the level that you want to load. This is found by entering the exportation menu, when it lists the levels, they have numbers next to them. This defines what number that the level is. For instance, FullWorld could be its name, but 5 could be its number.

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 craz3sl3nd3rfan · Oct 16, 2015 at 10:19 PM 0
Share

it didn't work…

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

how to switch between scene 4 Answers

how to change a script property for multiple objects 1 Answer

Audio Clip trouble 2 Answers

GUIlayout background image or color 0 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