public static CanvasKeyboard Open(Canvas canvas, GameObject inputObject = null, CanvasKeyboardType keyboardType = CanvasKeyboardType.ASCIICapable) { // Don't open the keyboard if it is already open for the current input object CanvasKeyboard keyboard = GameObject.FindObjectOfType <CanvasKeyboard>(); if (keyboard == null || (keyboard != null && keyboard.inputObject != inputObject)) { Close(); keyboard = Instantiate <CanvasKeyboard>(Resources.Load <CanvasKeyboard>("CanvasKeyboard")); keyboard.transform.SetParent(canvas.transform, false); keyboard.inputObject = inputObject; } if (inputObject != null && inputObject.GetComponent <InputField>() != null) { inputObject.GetComponent <InputField>().text = ""; } return(keyboard); }
public static CanvasKeyboard Open(Canvas canvas, GameObject inputObject = null, CanvasKeyboardType keyboardType = CanvasKeyboardType.ASCIICapable) { // Don't open the keyboard if it is already open for the current input object CanvasKeyboard keyboard = GameObject.FindObjectOfType<CanvasKeyboard>(); if (keyboard == null || (keyboard != null && keyboard.inputObject != inputObject)) { Close(); keyboard = Instantiate<CanvasKeyboard>(Resources.Load<CanvasKeyboard>("CanvasKeyboard")); keyboard.transform.SetParent(canvas.transform, false); //keyboard.inputObject = inputObject; } return keyboard; }