Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

How To --> Fade Out Music Before Loading Level

$
0
0
Hello all,

This is some simple code I wrote, but perhaps it may be of use to someone,

I use this to fade out my level music before I load a new level,

The new level is loaded by a button press, the button code is also below.
The level that gets loaded is set on the game object by the 'level' variable.

Code (csharp):
  1. var level : int;
  2.  
  3. function Update () {
  4. }
  5.  
  6. function OnGUI () {
  7.  
  8.     if (GUI.Button(Rect (168,116,166,28), "")) {    
  9.     FadeOutSoundAndLoadLevel(level);
  10.   }  
  11. }...
How To --> Fade Out Music Before Loading Level

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>