/// <summary> /// Deactivate on Awake. /// </summary> void Awake() { Instance = this; m_StartingScale = transform.localScale; Bounds canvasBounds = RectTransformUtility.CalculateRelativeRectTransformBounds(transform); RectTransform rect = GetComponent <RectTransform>(); m_ObjectBounds = new Vector3(canvasBounds.size.x * rect.localScale.x, canvasBounds.size.y * rect.localScale.y, canvasBounds.size.z * rect.localScale.z); // Actually find microphone key in the keyboard var dictationButton = TransformExtensions.GetChildRecursive(gameObject.transform, "Dictation"); if (dictationButton != null) { var dictationIcon = dictationButton.Find("keyboard_closeIcon"); if (dictationIcon != null) { _recordImage = dictationIcon.GetComponentInChildren <Image>(); var material = new Material(_recordImage.material); _defaultColor = material.color; _recordImage.material = material; } } // Setting the keyboardType to an undefined TouchScreenKeyboardType, // which prevents the MRTK keyboard from triggering the system keyboard itself. InputField.keyboardType = (TouchScreenKeyboardType)(int.MaxValue); // Keep keyboard deactivated until needed gameObject.SetActive(false); }