/// <summary> /// 创建声音设备 /// </summary> /// <param name="id"></param> /// <returns></returns> public static AudioDevice Create(string id = null) { if (null == id) { id = "AudioDeviceAutoId" + _autoId; _autoId++; } if (_deviceDic.ContainsKey(id)) { throw new System.Exception(string.Format("AudioDevice id [{0}] already exists!", id)); } if (null == _audioDeviceFactory) { _audioDeviceFactory = new GameObject("AudioDeviceFactory"); GameObject.DontDestroyOnLoad(_audioDeviceFactory); } var ad = new AudioDevice(id); _deviceDic.Add(id, ad); return(ad); }
public static void Destroy(AudioDevice target) { Destroy(target.Id); }