/// <summary> /// Get the voice engine instance /// </summary> /// <returns> the voice instance on success, or null on failed.</returns> public static IGCloudVoice GetEngine() { if (instance == null) { instance = new GCloudVoiceEngine(); } return(instance); }
/// <summary> /// Get the voice engine instance /// </summary> /// <returns> the voice instance on success, or null on failed.</returns> public static IGCloudVoice GetEngine() { if (instance == null) { instance = new GCloudVoiceEngine(); #if UNITY_ANDROID Debug.Log("GCloudVoice_C# API: Call java from c sharp before"); var activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); var currentActivity = activity.GetStatic <AndroidJavaObject>("currentActivity"); var context = currentActivity.Call <AndroidJavaObject>("getApplicationContext"); AndroidJavaClass jarVoice = new AndroidJavaClass("com.tencent.gcloud.voice.GCloudVoiceEngine"); AndroidJavaObject ins = jarVoice.CallStatic <AndroidJavaObject>("getInstance"); ins.Call <int>("init", context, currentActivity); Debug.Log("GCloudVoice_C# API: Call java from c sharp after"); #endif } return(instance); }