- Home /
All we need is..... Radio Gaga
Hey Guys, I have made a sort of GTA style radio script, which changes with use of the mouse wheel, thing is, it resets the audio clip and plays from the beginning each time. is there a way to store the duration and come back to it.
I did think about having them all playing from the begining and just controlling the volume, but wouldn't that be a bit hefty on the processor????
T. Hanks. Steve
By the way, has anyone notices when you're asking a question. The description of the icons over on the right, are incorrect :-)
#pragma strict
var krose : AudioClip;
var bounce : AudioClip;
var dust : AudioClip;
var PlayBack : AudioClip;
var playing : int = 1;
function Start () {
audio.loop = true;
audio.clip = krose;
audio.Play();
}
function Update () {
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
playing++;
if(playing >=5){
playing =1;
}
if(playing==1){
audio.clip = krose;
audio.Play();
}
if(playing==2){
audio.clip = bounce;
audio.Play();
}
if(playing==3){
audio.clip = dust;
audio.Play();
}
if(playing==4){
audio.clip = PlayBack;
audio.Play();
}
}
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
playing--;
if(playing <=0){
playing =4;
}
}
}
Unfortunately, I cannot help you more right now (time for bed she says...) than with this: http://docs.unity3d.com/Documentation/ScriptReference/AudioSource-time.html
Answer by Next Beat Games · Dec 18, 2012 at 08:57 PM
definitely do not have them all playing with their volumes set low. Look at the Unity scripting reference for functionality to store the current song index's cue position into an array. the api should also include a function to set the cue position
Your answer
![](https://koobas.hobune.stream/wayback/20220613085624im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Inconsistent ReverbZone / AudioSource.volume behavior 2 Answers
Breathing volume increases as player gets more tired 0 Answers
Volume rolloff: Distance to listener not changing. 3 Answers
Math formula to set volume levels nicely 0 Answers
Fading out before load script not functioning correctly? 2 Answers