OnUsernameInteract

This callback is invoked when a username has been interacted with in the chat box. Only called when Interactable Usernames is enabled.

Parameters

Vector2

The position of the input when the username was interacted with.

ChatInformation

The information about the chat that the input is over.

using UnityEngine;

public class ChatBoxExample : MonoBehaviour
{
	// BE SURE TO ASSIGN THIS IN THE INSPECTOR //
	public UltimateChatBox chatBox;


	void Start ()
	{
		chatBox.OnUsernameInteract += ( inputPosition, chatInfo ) =>
		{
			print( $"Username: {chatInfo.Username}\nHover Position: {inputPosition}" );
		};

		// OR //

		chatBox.OnUsernameInteract += OnUsernameInteract;
	}

	void OnUsernameInteract ( Vector2 inputPosition, UltimateChatBox.ChatInformation chatInfo )
	{
		print( $"This also works! Username: {chatInfo.Username}\nHover Position: {inputPosition}" );
	}
}

Last updated