public static void Insert(this TMP_InputField field, string str) { if (field.m_ReadOnly) { return; } field.Delete(); // Can't go past the character limit if (field.characterLimit > 0 && field.text.Length >= field.characterLimit) { return; } field.text = field.text.Insert(field.m_StringPosition, str); field.stringSelectPositionInternal = field.stringPositionInternal += str.Length; field.UpdateTouchKeyboardFromEditChanges(); field.SendOnValueChanged(); }