Tagaudio

How to add an audio file to a button in Unity3D

H

using UnityEngine; using System.Collections; using System; public class MainMenu : MonoBehaviour { public AudioSource audioSource; public AudioClip palySound; void Start ()  { } public void OnGUI() {  if(GUI.Button(new Rect(50,200,100,45),”Play”))  { audioSource.PlayOneShot(palySound); } }} when we attached the script in the inspector. we have to attach the AudioSource  from the...

Category