Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using JS;
- using UnityEngine;
- // get Audio Converter Here: https://pastebin.com/ND1misd2
- // Don't forget to Download the NAudio-Unity.dll
- // Should be able to find it on github
- public class PlayAudioClipFromPath : MonoBehaviour
- {
- [SerializeField]
- AudioSource _source;
- [SerializeField]
- string _filePath;
- [ContextMenu("Load and Play")]
- public async void LoadAndPlay()
- {
- var clip = await AudioConverter.LoadAudioFile(_filePath);
- _source.clip = clip;
- _source.Play();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement