/// <summary>
 /// Start the sequence and its corresponding text field UI.
 /// </summary>
 public void Start()
 {
     Transform textFieldUIObject = FindTextFieldUIObject();
     if (textFieldUIObject != null)
     {
         bool currentlyActive = textFieldUIObject.gameObject.activeSelf;
         if (!currentlyActive) textFieldUIObject.gameObject.SetActive(true);
         textFieldUI = textFieldUIObject.GetComponent(typeof(ITextFieldUI)) as ITextFieldUI;
         if (!currentlyActive) textFieldUIObject.gameObject.SetActive(false);
     }
     string labelText = GetParameter(1);
     variableName = GetParameter(2);
     int maxLength = GetParameterAsInt(3);
     bool clearField = string.Equals(GetParameter(4), "clear");
     if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: TextInput({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, Tools.GetObjectName(textFieldUIObject), labelText, variableName, maxLength }));
     if (string.IsNullOrEmpty(variableName))
     {
         if (DialogueDebug.logWarnings) Debug.Log(string.Format("{0}: Sequencer: TextInput({1}): The third parameter must be the name of a Dialogue System variable.", new System.Object[] { DialogueDebug.Prefix, GetParameters() }));
         Stop();
     }
     else if (textFieldUI == null)
     {
         if (DialogueDebug.logWarnings) Debug.Log(string.Format("{0}: Sequencer: TextInput(): Text Field UI not found on a GameObject '{1}'. Did you specify the correct GameObject name?", new System.Object[] { DialogueDebug.Prefix, GetParameter(0) }));
         Stop();
     }
     else
     {
         if (labelText.StartsWith("var="))
         {
             labelText = DialogueLua.GetVariable(labelText.Substring(4)).asString;
         }
         string variableValue = clearField ? string.Empty : DialogueLua.GetVariable(variableName).asString;
         textFieldUI.StartTextInput(labelText, variableValue, maxLength, OnAcceptedText);
     }
 }
        /// <summary>
        /// Start the sequence and its corresponding text field UI.
        /// </summary>
        public void Start()
        {
            Transform textFieldUIObject = GetSubject(0);

            if (textFieldUIObject != null)
            {
                bool currentlyActive = textFieldUIObject.gameObject.activeSelf;
                if (!currentlyActive)
                {
                    textFieldUIObject.gameObject.SetActive(true);
                }
                textFieldUI = textFieldUIObject.GetComponent(typeof(ITextFieldUI)) as ITextFieldUI;
                if (!currentlyActive)
                {
                    textFieldUIObject.gameObject.SetActive(false);
                }
            }
            string labelText = GetParameter(1);

            variableName = GetParameter(2);
            int maxLength = GetParameterAsInt(3);

            if (DialogueDebug.LogInfo)
            {
                Debug.Log(string.Format("{0}: Sequencer: TextInput({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, Tools.GetObjectName(textFieldUIObject), labelText, variableName, maxLength }));
            }
            if (textFieldUI != null)
            {
                string variableValue = Lua.Run(string.Format("return Variable[\"{0}\"]", new System.Object[] { variableName })).AsString;
                textFieldUI.StartTextInput(labelText, variableValue, maxLength, OnAcceptedText);
            }
            else
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.Log(string.Format("{0}: Sequencer: TextInput(): Text Field UI not found on a GameObject '{1}'. Did you specify the correct GameObject name?", new System.Object[] { DialogueDebug.Prefix, GetParameter(0) }));
                }
                Stop();
            }
        }