Delete channels

Unity Chat SDK lets you permanently remove an existing channel from App Context storage using one of these methods: Delete() and DeleteChannel().

Both of these methods give the same output. The only difference is that you call a given method either on the Chat (DeleteChannel()) or the Channel (Delete()) object. Depending on the object, these methods take a different set of input parameters - you either have to specify the channel ID you want to delete or not because it's already known.

Requires App Context

To store data about channels, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

These methods take the following parameters:

  • Delete()

    channel.Delete()
  • DeleteChannel()

    chat.DeleteChannel(
    string channelId
    )

Input

ParameterTypeRequired in Delete()Required in DeleteChannel()DefaultDescription
channelIdstringNoYesn/aUnique channel identifier.

Output

These methods don't return any data.

Basic usage

Delete the channel with the ID of support.

  • Delete()

    if (!chat.TryGetChannel("support", out var channel))
    {
    Console.WriteLine("Channel to delete doesn't exist.");
    return;
    };

    channel.Delete()
  • DeleteChannel()

    chat.DeleteChannel("support")
Last updated on