EnableInputField

Enables the input field associated with the Ultimate Chat Box. If a string is provided to the function, the input field will be opened with the string value applied.

using UnityEngine;

public class ChatBoxExample : MonoBehaviour
{
	// BE SURE TO ASSIGN THIS IN THE INSPECTOR //
	public UltimateChatBox chatBox;
	
	void Update ()
	{
		// If the forward slash key has been pressed...
    		if( Input.GetKeyDown( KeyCode.Slash ) )
        	{
        		// Enable the input field of the chat box with a default value of /.
			chatBox.EnableInputField( "/" );
        	}
        	// Else if the Return key has been pressed and the input field is NOT currently enabled...
        	else if( Input.GetKeyDown( KeyCode.Return ) && !chatBox.InputFieldEnabled )
        	{
        		// Enable the input field.
        		chatBox.EnableInputField();
        	}
	}
}

Last updated