Skip to main content

GUAFriendBaseResultObserver

[MSDK & Player Network SDK] Register the callback of the friend module, the game needs to process the callback function. For more information on the callback data structure, see GUABaseResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function Definition

The list of methods used to process the callback events.

Callback EventCommon[Player Network SDK Only][MSDK Only]
FriendBaseEventsSendMessage,
Share
-AddFriend
event OnResultHandler<GUABaseResult> FriendBaseEvents;

Code Sample

// Add callbacks
UnionAdapterAPI.GetFriendService().FriendBaseEvents += OnFriendBaseEvent;

// Remove callbacks
UnionAdapterAPI.GetFriendService().FriendBaseEvents -= OnFriendBaseEvent;

// FriendBaseEvents callback
private void OnFriendBaseEvent(GUABaseResult baseRet)
{
string methodTag = "";

if (baseRet.MethodId == (int)GUAMethodID.GUA_FRIEND_SHARE)
{
methodTag = "Share";
}
else if (baseRet.MethodId == (int)GUAMethodID.GUA_FRIEND_SEND_MESSAGE)
{
methodTag = "SendMessage";
}
Debug.Log.(methodTag + baseRet.ToString());
}