Skip to main content

Overview - Add friends - (Unity module)

Last updated on June 12, 2024

Introduction

Players may want to invite each other to become friends to make it easier to play together. In this module, you will learn how to display a list of friend requests, and implement accepting, rejecting, or canceling those requests.

Prerequisites

  • To have completed the following modules:

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

  • To force enable this module by adding the following code to the Assets/Resources/Modules/TutorialModuleConfig.json file:

      {
    "enableModulesOverride": true,
    "forceEnabledModules": ["FriendEssentials"],
    "forceDisabledOtherModules" : true,
    }

Learning objectives

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

  • Requesting and displaying sent and received friend requests.
  • Accepting or rejecting received friend requests.
  • Canceling sent friend requests.

Preview

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

Accept a received friend request demo Unity Byte Wars add friends

Success to accept friend {friendId}

Reject a received friend request demo Unity Byte Wars add friends

Success to reject friend request {friendId}

Cancel a sent friend request demo Unity Byte Wars add friends

Success to cancel outgoing friend request {friendId}.