Ejemplo n.º 1
0
    public void SwitchVoice(bool isVoice)
    {
        //音声認識
        if (isVoice)
        {
            if (cloneFreqRecogInGame != null)
            {
                Destroy(cloneFreqRecogInGame);
            }
            //マイク存在確認
            if (Microphone.devices.Length > 0)
            {
                var gameObject = GameObject.Find("SynchronizationContextRunner");
                //これをとりのぞかないと、音声認識しない
                if (gameObject != null)
                {
                    Destroy(gameObject);
                }

                cloneJulius = Instantiate(julius);
                wordDisplay.FetchJulius();
            }
        }
        else if (!isVoice)
        {
            if (cloneJulius != null)
            {
                Destroy(cloneJulius);
            }
            cloneFreqRecogInGame = Instantiate(FreqRecogInGame);
        }
    }