Skip to main content

Overview - Manage friends - (Unity module)

Last updated on December 13, 2024

Introduction

In any online environment, it's important to be able to manage and control who your friends are. This module shows you how to unfriend, block players, and unblock players.

Prerequisites

In order to complete this module, you will need:

  • To have completed the Display friend list module.

  • The Byte Wars tutorialmodules branch checked out in your local Byte Wars Unity project repository.

  • To have force enabled this module. You can do this by modifying the following code in the Assets/Resources/Modules/TutorialModuleConfig.json file:

      {
    "enableModulesOverride": true,
    "forceEnabledModules": ["ManagingFriends"],
    }

Learning objectives

At the end of this module, you will know how to implement:

  • Querying and displaying a list of blocked players.
  • Blocking players.
  • Unblocking players.
  • Unfriending players on the friend list.

Preview

At the end of this module, your project will look like the images below with the following logs:

  • Block a player

    Block a friend demo Unity Byte Wars manage friends

    [ManagingFriendsWrapper_Starter.cs] [BlockPlayer] - Successfully blocked player with user Id: {userId}
  • Unblock a player

    Unblock a player demo Unity Byte Wars manage friends

    [ManagingFriendsWrapper_Starter.cs] [UnblockPlayer] - Successfully unblocked player with user Id: {userId}
  • Unfriend a friend

    Unfriend a friend demo Unity Byte Wars manage friends

    [ManagingFriendsWrapper_Starter.cs] [Unfriend] - Successfully unfriended player with user Id: {userId}