// Use this for initialization void Start() { if (Application.platform == RuntimePlatform.IPhonePlayer) { transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z); } //textSpawnPoint.gameObject.SetActive (false); //translatedSpawnPoint.gameObject.SetActive (false); //currentLabel = Instantiate (label, textSpawnPoint.position, textSpawnPoint.rotation, canvas.transform) as GameObject; translate = GameObject.FindGameObjectWithTag("Translate").GetComponent <TranslateWatson> (); //CameraDevice.Instance.SetFrameFormat (PixelFormat, true); //Application.RequestUserAuthorization (UserAuthorization.WebCam); headers = new Dictionary <string, string>(); headers.Add("Content-Type", "application/json; charset=UTF-8"); if (apiKey == null || apiKey == "") { Debug.LogError("No API key. Please set your API key into the \"Web Cam Texture To Cloud Vision(Script)\" component."); } WebCamDevice[] devices = WebCamTexture.devices; for (var i = 0; i < devices.Length; i++) { Debug.Log(devices [i].name); } if (devices.Length > 0) { webcamTexture = new WebCamTexture(devices[0].name, requestedWidth, requestedHeight); //webcamTexture = new WebCamTexture(devices[0].name); Renderer r = GetComponent <Renderer> (); if (r != null) { Material m = r.material; if (m != null) { m.mainTexture = webcamTexture; } } webcamTexture.Play(); StartCoroutine("Capture"); } }
// Use this for initialization void Start() { langList = GetComponent <Dropdown> (); webcam = GameObject.FindGameObjectWithTag("Webcam").GetComponent <WebCamTextureToCloudVision> (); translate = GameObject.FindGameObjectWithTag("Translate").GetComponent <TranslateWatson> (); langList.onValueChanged.AddListener(delegate { ChangeLanguage(langList); }); webcam.SetCurrentLanguage("en"); translate.SetCurrentVoice(VoiceType.fr_FR_Renee); }