FindChatsOfStyle

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

using UnityEngine;
using TankAndHealerStudioAssets;

public class ChatBoxExample : MonoBehaviour
{
	// BE SURE TO ASSIGN THESE IN THE INSPECTOR //
	public UltimateChatBox chatBox;
	
	void Update ()
	{
		// If the space key was pressed this frame...
		if( Input.GetKeyDown( KeyCode.Space ) )
		{
			// Store an array with all the System Message chats.
			UltimateChatBox.ChatInformation[] chatsWithStyle = chatBox.FindChatsOfStyle( UltimateChatBoxStyles.systemMessage ).ToArray();

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

Last updated