Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AudioClip clip = new WWW("File:///" + Application.streamingAssetsPath + "/AudioFile.ogg").GetAudioClipCompressed();
- //--You can use this audio clip in several ways.
- //Play it as a background music
- JukeboxScript j = FindObjectOfType<JukeboxScript>();
- j.Custom.clip = clip;
- j.PlayCustom();
- //Just play it one shot
- AudioSource src = FindObjectOfType<AudioListener>().gameObject.AddComponent<AudioSource>();
- src.clip = clip;
- src.Play();
- //Play it attached to the game object
- GameObject clipOwner = new GameObject();
- AudioClipPlayer.PlayAttached(clip, attachedGameObj.transform.position, attachedGameObj.transform, 1f, maxDistance, out clipOwner, Yandere.transform.position.y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement