How do I merge audio and animation with array in random

by Rangel   Last Updated February 11, 2019 02:13 AM

I made this script it merge audio and string every time the audio is played it calls a name, more always in sync with random.

I wanted to know how I do to insert an array of animation in place of the strings, I tried several logics but none worked

public Text Author;
public String[] Names;
private int MusicPlays;
public AudioSource[] Music;

void MyMusic(int Number){
    MusicPlays = Number;
    Author.text = Names[Number];
    Music[Number].Play();
}

void Start(){
MyMusic(Random.Range(0, Music.Length))
}

void Update(){
    if (!Music[MusicPlays].isPlaying){
        MyMusic(Random.Range(0, Music.Length));
    }
}


Related Questions


Updated May 20, 2018 19:13 PM

Updated April 06, 2016 08:05 AM

Updated April 23, 2016 08:05 AM

Updated August 19, 2017 04:13 AM

Updated October 27, 2017 16:13 PM