AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
AudioSourcePlayClipExtension.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity
7 {
11  public static class AudioSourcePlayClipExtension
12  {
13  public static void PlayClip(this AudioSource source, UnityEngine.AudioClip clip, bool loop = false)
14  {
15  source.clip = clip;
16  source.loop = loop;
17  source.Play();
18  }
19  }
20 }
A shortcut to assign a clip to an AudioSource component and play the source
static void PlayClip(this AudioSource source, UnityEngine.AudioClip clip, bool loop=false)