Skip to content

Instantly share code, notes, and snippets.

@yunojy yunojy/PlayAudio.cs
Created Dec 24, 2016

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
You can’t perform that action at this time.