UI Components

The Universal Friend List includes a set of UI scripts that handle displaying friends, requests, and handling user interactions. These components are designed to be used with the included prefabs but can also be adapted for custom UIs.

FriendListUI

Scripts/UI/FriendListUI.cs

The main UI controller for the friend list panel. This component manages the complete friend list interface including tabs for friends, requests, and blocked users.

Key Features

  • Tab-based navigation (Friends, Requests, Blocked)
  • Automatic list updates via events
  • Search/filter functionality
  • Status indicator display
  • Context menu actions (invite, remove, block)

Inspector Fields

FieldDescription
Friend ManagerReference to FriendManager component
Friend List ContainerParent transform for friend list items
Friend List Item PrefabPrefab for individual friend rows
Request ContainerParent transform for request items
Request Item PrefabPrefab for request rows
Blocked ContainerParent transform for blocked user items
Blocked Item PrefabPrefab for blocked user rows

FriendListItemUI

Scripts/UI/FriendListItemUI.cs

Component for individual friend row items. Displays a friend's name, status, and provides action buttons.

Display Information

  • Friend's display name
  • Online status (Online, Offline, In Room, Away)
  • Current room/game info (when applicable)
  • Last seen timestamp (for offline friends)

Available Actions

  • Send message (if supported)
  • View profile (if supported)
  • Invite to game
  • Join friend's room
  • Remove from friends

FriendRequestItemUI

Scripts/UI/FriendRequestItemUI.cs

Component for friend request rows. Handles displaying incoming and outgoing requests with accept/reject actions.

Request Types

  • Incoming: Shows who wants to be your friend with Accept/Reject buttons
  • Outgoing: Shows requests you've sent with a Cancel option

Actions

  • Accept request
  • Reject request
  • Cancel outgoing request
  • View sender profile

FriendRequestsUI

Scripts/UI/FriendRequestsUI.cs

Controller for the friend requests panel. Manages the list of pending requests and handles batch operations.

Features

  • Separate sections for incoming and outgoing requests
  • Badge showing count of pending incoming requests
  • Accept all / Reject all options
  • Automatic refresh on events

AddFriendUI

Scripts/UI/AddFriendUI.cs

Component for the "Add Friend" dialog/panel. Handles searching for users and sending friend requests.

Features

  • Username/user ID search input
  • Search results display
  • Send request button
  • Error handling for invalid users
  • Success/failure feedback

Using the UI Prefabs

Quick Setup with Prefabs

  1. Drag Prefabs/FriendListUI.prefab into your Canvas
  2. Select the imported prefab instance
  3. In the Inspector, find the Friend Manager field
  4. Assign your FriendManager or FriendManagerInitializer object
  5. The UI will automatically connect and start displaying data

Customizing the UI

The prefabs use standard Unity UI components (Text, Image, Button) that you can customize freely. The UI scripts listen to FriendManager events and update the display automatically.