FindChatsFromUser

Returns all the chats that have been registered with the targeted username.

using UnityEngine;

public class ChatBoxExample : MonoBehaviour
{
	// BE SURE TO ASSIGN THESE IN THE INSPECTOR //
	public UltimateChatBox chatBox;
	
	void Start ()
	{
		// Subscribe to the OnUsernameInteract callback with the following functionality...
		chatBox.OnUsernameInteract += ( chatInfo ) =>
		{
			// Store an array of all chats that are registered from the interacted username.
			UltimateChatBox.ChatInformation[] chatsFromUser = chatBox.FindChatsFromUser( chatInfo.InternalUsername ).ToArray();

			// Loop through each chat in the array and remove the chats from the chat box.
			for( int i = 0; i < chatsFromUser.Length; i++ )
				chatsFromUser[ i ].RemoveChat();
		};
	}
}

Last updated