⚪
Tank & Healer Studio Assets
Return to Website
Ultimate Chat Box
Ultimate Chat Box
  • 🟠Introduction
    • 👋Welcome!
    • ⚡Getting Started
  • 📖Documentation
    • UltimateChatBox
      • Public Methods
        • RegisterChat (+4 overloads)
        • Enable
        • Disable
        • ClearChat
        • EnableInputField
        • ToggleInputField
        • DisableInputField
        • SendCustomInput
        • FindChatsFromUser
        • FindChatsOfStyle
        • UpdatePositioning
      • Events
        • OnChatRegistered
        • OnUsernameHover
        • OnUsernameInteract
        • OnInputFieldUpdated
        • OnInputFieldSubmitted
        • OnInputFieldCommandUpdated
        • OnInputFieldCommandSubmitted
        • OnExtraImageInteract
      • Public Classes
        • ChatInformation
        • ChatStyle
      • Properties
    • UltimateChatBoxStyles
      • Creating a custom Chat Style
  • 💡Tips & Tricks
    • Catching Commands
  • Helpful Links
    • Support Discord
    • Leave us a review!
Powered by GitBook
On this page

Was this helpful?

  1. Documentation
  2. UltimateChatBox
  3. Public Methods

FindChatsFromUser

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

using UnityEngine;
using TankAndHealerStudioAssets;

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();
		};
	}
}

PreviousSendCustomInputNextFindChatsOfStyle

Last updated 6 months ago

Was this helpful?

📖