(Unity) How to get players OculusID / Username
I have been trying to retrieve the username but I can't get anything to work. Here's the program below. It retrieves the user's OculusID and sets a variable that is synced on the network. When this is run, it returns as a null reference exception.
Users.GetLoggedInUser().OnComplete((Message<User> uMsg) =>
{
if (uMsg.IsError)
{
Debug.LogError("Platform: GetLoggedInUser() failed. Reason: " + uMsg.GetError().Message);
return; // no need to go any further if local user can't be determined
}
else
{
// success, process user structure we receive in uMsg.Data
newClientClass.nickName = uMsg.Data.OculusID;
}
});
I cannot find any example code or documentation on how to properly implement this.
