Advertisement
Guest User

Play Audio

a guest
Dec 1st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. public AudioClip[] audioClip;
  2.   void PlaySound(int clip)
  3.     {
  4.         auio.clip  = audioClip {clip};
  5.         audio.Play ();
  6.     }
  7.  
  8. void OnTriggerLeftclick (Collider other)
  9. {
  10. audio.PlayOneShot(audioFile);
  11. }  
  12.  
  13. using UnityEngine;
  14. using System.Collections;
  15.  
  16. public class PlayDoorSound : MonoBehaviour {
  17.  
  18.     public AudioClip weaponSound;
  19.  
  20.     public void PlayweaponnSound()
  21.     {
  22.         GetComponent<AudioSource>().PlayOneShot(weaponSound);
  23.         Debug.Log("Weapon Sound Played!");
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement