Advertisement
duck

Narration Control

Dec 12th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class NarrationControl : MonoBehaviour {
  5.    
  6.     public AudioClip[] narrations;
  7.    
  8.    
  9.     public void Play( string name )
  10.     {
  11.    
  12.         foreach (var clip in narrations)
  13.         {
  14.             if (clip.name == name)
  15.             {
  16.                 audio.clip = clip;
  17.                 audio.Play ();
  18.             }
  19.         }
  20.        
  21.        
  22.     }
  23.    
  24.    
  25.    
  26.    
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement