Forum Discussion
TenaciousDan
1 year agoExplorer
Cannot get a list of user's friends in a build
Users. is not firing the callback in a build.
When we run the game in the Unity Editor, everything works as expected. The editor uses the AppId of the Rift version of the app while the build is running on the headset directly and using the AppID of the Quest version of the app.
- Data Use Checkup is all good and everything is allowed for the app (Quest App).
- We are using Users.GetLoggedInUser() just fine in the build to get the user's username.
- All the user's friends have launched the game and are also in the app.
Why is the callback not being fired in a build? Any help is appreciated.
Below is the code for the function I am calling. "HERE GetLoggedInUserFriends" is printed but none of the other logs are printed which means the callback is never fired.
public void GetLoggedInUserFriends(Action<List<User>> onSuccess, Action<Error> onError = null)
{
Debug.Log("HERE GetLoggedInUserFriends");
Users.GetLoggedInUserFriends().OnComplete(msg =>
{
if (msg.IsError)
{
Error error = msg.GetError();
Debug.LogError($"[{nameof(GroupPresenceManager)}] Failed to get LoggedInUser Friends: {error.Code} - {error.Message}");
onError?.Invoke(error);
}
else
{
Debug.Log($"[{nameof(GroupPresenceManager)}] Got LoggedInUser Friends successfully.");
List<User> users = msg.Data.ToList();
onSuccess?.Invoke(users);
}
});
}
We figured out our issue.
We were initializing the core sdk too early (we were using SubsystemRegistration). We switched to BeforeSceneLoad and the callbacks started being fired. We also moved all the code to the main thread.
There is a monobehaviour script that the core sdk uses to respond to events which gets added into the current scene and responds to callbacks in the Update() function. Because we were initializing too early, the Monobehaviour was initialized but then destroyed on initial scene load causing all the event callbacks to not fire correctly except for a few related to authorization and entitlements, probably only the ones that had to listen to responses from web requests.
1 Reply
- TenaciousDanExplorer
We figured out our issue.
We were initializing the core sdk too early (we were using SubsystemRegistration). We switched to BeforeSceneLoad and the callbacks started being fired. We also moved all the code to the main thread.
There is a monobehaviour script that the core sdk uses to respond to events which gets added into the current scene and responds to callbacks in the Update() function. Because we were initializing too early, the Monobehaviour was initialized but then destroyed on initial scene load causing all the event callbacks to not fire correctly except for a few related to authorization and entitlements, probably only the ones that had to listen to responses from web requests.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 8 months ago
- 7 months ago