Create a gist now

Instantly share code, notes, and snippets.

using UnityEngine;
public class UIPlayAtom : MonoBehaviour
public string cueName; //再生するキュー名//
public string cueSheet; //再生するキューが入ったキューシート名//
public float volume;
public flota pitch;
static CriAtomSource atomSourceNGUI;
static CriAtomListener atomListenerNGUI;
Camera cam;
void Awake()
cam = Camera.main;
if (cam == null)
cam = GameObject.FindObjectOfType(typeof(Camera)) as Camera;
atomListenerNGUI = cam.gameObject.GetComponent<CriAtomListener>();
if(atomListenerNGUI == null)
atomListenerNGUI = cam.gameObject.AddComponent<CriAtomListener>();
atomSourceNGUI = cam.gameObject.GetComponent<CriAtomSource>();
if(atomSourceNGUI == null)
atomSourceNGUI = cam.gameObject.AddComponent<CriAtomSource>();
if (cueSheet != null)
atomSourceNGUI.cueSheet = this.cueSheet;
//NGUITools.PlaySound(audioClip, volume, pitch);の部分をPlayCue ();に差し替える//
public void PlayCue ()
atomSourceNGUI.volume = this.volume;
atomSourceNGUI.pitch = this.pitch;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment