Quantcast
Channel: Latest Questions by robertmathew
Viewing all articles
Browse latest Browse all 60

pause a audio inside game

$
0
0
            function OnGUI()
                    {
       if(GUI.Button(Rect(100,200,100,50),"pause")) //to pause the game
                   {
            Time.timeScale = 0; 
                   }
       if(GUI.Button(Rect(200,300,100,50),"play"))   // to resume the game
                   {
           Time.timeScale = 1;  
                   }
                   }

here when i press pause button it should pause the game and when press play button it should resume the game where i stopped.here pause button is not working.

my need is when i press the pause button it should stop all current action including the audio which is playing in the game .

when i press the play button after pausing the game. it should start from where i paused the game including the audio where it stopped.

on further when ever i pause and play the game in the second scene .it should not play the old audio in the first scene.

i have went through this answer http://answers.unity3d.com/questions/21/how-do-i-pause-my-game

but not able to solve the problem.so i posted the question.

so can any body help me.


Viewing all articles
Browse latest Browse all 60

Trending Articles



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