Unity Setup Overview

This section covers everything you need to set up Universal Friend List in your Unity project. The system consists of three main components that work together to provide friend functionality.

Required Components

1. FriendManagerSettings (ScriptableObject)

A configuration asset that holds all the settings for your friend system. This is stored as a .asset file in your project and can be shared across scenes.

Purpose: Centralized configuration for backend type, server URLs, limits, and behavior flags.

Location: Assets/ElderWorldStudio/FriendList/Resources/FriendManagerSettings.asset (pre-created) or create your own via Assets → Create → ElderWorldStudio/Friend List → Friend Manager Settings

2. FriendManagerInitializer (Component)

A MonoBehaviour that wires up the friend system when your game starts. It connects the settings, creates the network system, and handles initialization.

Purpose: Bootstrap the friend system after user authentication, set the user ID, and control when initialization happens.

Placement: Add to a persistent GameObject in your first scene (like a GameManager).

3. FriendManager (Component)

The main runtime component that manages all friend operations. It handles events, coordinates with the network layer, and exposes UnityEvents for UI binding.

Purpose: Core business logic for friends, requests, blocking, and presence. Also provides game-type routing for invitations.

Placement: Automatically added by the initializer, or add manually to a DontDestroyOnLoad object.

Setup Options

Automatic Setup (Recommended)

Use the Editor Tools for the fastest setup:

  1. Open Window → ElderWorldStudio/Friend List
  2. Click Quick Setup
  3. The wizard will create all required objects and connect them
  4. Assign your settings asset if prompted

Manual Setup

For more control, set up components manually:

  1. Create an empty GameObject named "FriendSystem"
  2. Add the FriendManagerInitializer component
  3. Assign your FriendManagerSettings to the Initializer
  4. Set InitializeOnStart = true (or call Initialize() manually)
  5. Add FriendManager component (created automatically by Initializer)

How Components Connect

Understanding the relationship between the three main components:

ComponentCreatesDepends On
FriendManagerInitializerFriendManager, Network SystemFriendManagerSettings, User ID
FriendManagerEvents, Game Type HandlerSettings, Network System, User ID
FriendManagerSettingsNone (data only)None

Initialization Flow

  1. Game starts → FriendManagerInitializer.Awake()
  2. Settings are validated and applied
  3. When Initialize() is called → Network system is created based on BackendType
  4. Network system connects → FriendManager initializes internal state
  5. FriendManager loads cached friends (if persistence enabled)
  6. FriendManager subscribes to network system events
  7. System is now ready for friend operations

UnityEvents for UI Binding

FriendManager exposes UnityEvents that you can wire up directly in the Inspector without code. This makes it easy to connect UI elements visually.

EventTrigger
On Friend List UpdatedFriend list refreshed or changed
On Friend Request ReceivedNew incoming friend request
On Friend Request AcceptedSomeone accepted your request
On Friend Request RejectedSomeone rejected your request
On Friend Request CancelledRequest sender cancelled
On Friend Status ChangedFriend came online/went offline
On Friend AddedNew friend successfully added
On Friend RemovedFriend removed from list
On User BlockedUser successfully blocked
On User UnblockedUser removed from block list
On Invitation ReceivedGame invitation received

Next Steps