//Preview playback callback handler ('key' required)
    private void PreviewVolume(string message)
    {
#if UNITY_EDITOR
        Debug.Log("PreviewVolume : " + message);
#endif
        if (!string.IsNullOrEmpty(message) && volumeController != null)
        {
            string[] param = message.Split('=');  //"key=value" format only
            if (param.Length > 1)
            {
                //Select AudioSource from the key
                string key = param[0];
                volumeController.Play(key);

                //Set a software volume
                float vol = float.Parse(param[1]);
                volumeController.SetVolume(key, vol);
            }
        }
    }
Example #2
0
    //プレビュー再生コールバックハンドラ(キーが必要)
    private void PreviewVolume(string message)
    {
#if UNITY_EDITOR
        Debug.Log("PreviewVolume : " + message);
#endif
        if (!string.IsNullOrEmpty(message) && volumeController != null)
        {
            string[] param = message.Split('=');  //key=value の形式
            if (param.Length > 1)
            {
                //スライダーのキーから AudioSource を選択
                string key = param[0];
                volumeController.Play(key);

                //音量設定
                float vol = float.Parse(param[1]);
                volumeController.SetVolume(key, vol);
            }
        }
    }