SendCustomInput
Sends custom input to the chat box to process.
using UnityEngine;
public class ChatBoxExample : MonoBehaviour
{
// BE SURE TO ASSIGN THESE IN THE INSPECTOR //
public UltimateChatBox chatBox;
public RectTransform inputImage;
void Update ()
{
// If the input image is null, then return to avoid errors.
if( inputImage == null )
return;
// Modify the input image's position by the horizontal and vertical axis. This example works well with controller input. Although it will work with WASD also.
inputImage.anchoredPosition += new Vector2( Input.GetAxis( "Horizontal" ), Input.GetAxis( "Vertical" ) );
// Send the custom input data to the chat box to process.
chatBox.SendCustomInput( inputImage.anchoredPosition, Input.GetButtonDown( "Submit" ), Input.GetButton( "Submit" ) );
}
}
Last updated