Friend Profile
Like what your seeing?
Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
Introduction
Friend profile is a simple implementation of the IUserProfile interface and is used in the prefab examples for FriendList and other controls. In most cases you will want to create your own "Friend Profile" UI script and can use the included FriendProfile as an example to get started with.
Creating your own
You can implement the IUserProfile interface on your custom profile script and this will allow all of the other profile related UI tools to work with it. That is you can create a custom profile like this and the FriendList, FriendGroup and other friend related controls will be able to work with it thanks to the IUserProfile interface.
The IUserProfile interface requires you to implement two features
The UserData field and the Apply method are the two required features of the IUserProfile interface. You can use the implementation shown above as a good starting off point adding whatever code your UI requires to the Apply method.
Events
The following event is available on the FriendProfile that ships with the kit.
This object is meant as an example to get you started with creating your own.
evtLoaded
A simple event that is raised when the UserData is loaded to the UI controls. This event has no arguments.
Fields and Attributes
The following describes the definition of the FriendProfile that ships with the kit.
This object is meant as an example to get you started with creating your own.
useLocalUser
A private field only accessible in the Unity Inspector, you can set this to true and the profile will automatically load the local user's UserData on start.
appendNickname
If false then the display name field will get the Nickname if available and Friend name if not. If true then the display name will always be the Friend name and the nickname field will be used for nick if available.
messageOptions
Defines the options for displaying status messages for the profile in question such as online, offline, if they are in a game or other game and rather or not the other game should be named. This uses the MessageOptions sub struct.
avatar
A private field pointing to the RawImage control that will be used to display the user's avatar. This can only be set in the Unity Inspector.
displayName
The settings and options for displaying the user's name, this uses the TextField sub struct.
nickName
The settings and options for displaying the user's nick name, this uses the TextField sub struct.
statusLabel
The settings and options for displaying the user's status as text, this uses the TextField sub struct.
statusImage
The settings and options for displaying the user's status as an image, this uses the ImageField sub struct.
friendId
The settings and options for displaying the user's friend ID, this uses the TextField sub struct.
level
The settings and options for displaying the user's status as text, this uses the TextField sub struct.
panel
The settings and options for displaying the user's status as a change in panel, this uses the ImageField sub struct.
Last updated