SHARE
TWEET

Untitled

a guest Apr 18th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AudioClip clip = new WWW("File:///" + Application.streamingAssetsPath + "/AudioFile.ogg").GetAudioClipCompressed();
  2.  
  3. //--You can use this audio clip in several ways.
  4.  
  5. //Play it as a background music
  6. JukeboxScript j = FindObjectOfType<JukeboxScript>();
  7. j.Custom.clip = clip;
  8. j.PlayCustom();
  9.  
  10. //Just play it one shot
  11. AudioSource src = FindObjectOfType<AudioListener>().gameObject.AddComponent<AudioSource>();
  12. src.clip = clip;
  13. src.Play();
  14.  
  15. //Play it attached to the game object
  16. GameObject clipOwner = new GameObject();
  17. AudioClipPlayer.PlayAttached(clip, attachedGameObj.transform.position, attachedGameObj.transform, 1f, maxDistance, out clipOwner, Yandere.transform.position.y);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top