I have an array with several pieces of music that plays randomly. What I’m trying to do is play the same song that is currently being played on that game object, on another game object.
So for example. If the current song being played is listed as number 3 in the array, I need the other game object (gameObject A) to also play number 3 and at the same time on (gameObjectB).
Any ideas on how to go about doing this?
Any help is really appreciated.
You can create a music manager that have your music array with audio clips. You can choose you music the way you want in the music manager. Just make your manager instance accessible from other game objects by applying a singleton pattern (pretty easy to find).
Then in your other gameobjects, you can directly access your music using your manager and get your audio clips.
AudioClip ac = MusicManager.Instance.CurrentMusic();
audio.clip = ac;
You will need a MusicManager script and MusicPlayer + AudioSource scripts for example.