- Home /
Question by
VeTK85 · Mar 16, 2018 at 06:54 PM ·
animationrandomaudiosource
Random AudioSource and Animation?
how to synchronize audiosource and animation in random? for example every time the audio starts up it is called an animation [].
Note I already know how to do with sprite and image example script using string / text and audiosource
public AudioSource[] music;
public string[] name;
public Text textname;
private int sound;
void mymusic(int ON){sound = ON; textname.text = name[ON]; music[ON].Play();
}
void Start(){mymusic(Random.Range(0, music.Length));}
void Update(){
if (!music[sound].isPlaying)
{
mymusic(Random.Range(0, music.Length));
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to play transitioned animation at random time 1 Answer
Playing random animation by Animator Controller 2 Answers
Can the animation editor create local rotational data? 3 Answers
Execute Random Animations 1 Answer
Adding animation clips via script 2 Answers