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
| Field | Description |
|---|---|
Friend Manager | Reference to FriendManager component |
Friend List Container | Parent transform for friend list items |
Friend List Item Prefab | Prefab for individual friend rows |
Request Container | Parent transform for request items |
Request Item Prefab | Prefab for request rows |
Blocked Container | Parent transform for blocked user items |
Blocked Item Prefab | Prefab 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
- Drag
Prefabs/FriendListUI.prefabinto your Canvas - Select the imported prefab instance
- In the Inspector, find the
Friend Managerfield - Assign your
FriendManagerorFriendManagerInitializerobject - 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.