Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayAudio : MonoBehaviour {
public AudioClip[] audioClips;
private AudioSource audioSource;
void Start() {
audioSource = gameObject.GetComponent<AudioSource>();
public void RandomPlay() {
audioSource.clip = audioClips[Random.Range(0, audioClips.Length)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment