Social.localuser.image Returns Null In Unity3d
Solution 1:
The Social API in Unity is only implemented for iOS.
For the Google Play Services i really recommend buying the prime31 Google Play Game Services Plugin for 75$.
Alternatively there is also a Open Source Play Games Unity Plugin from Google, but I can't recommend it, because I was not able to integrated it properly without sign in bugs.
UPDATE 1
The implementation for Social.localUser.image
of the Play Games Unity Plugin returns always null. see PlayGamesUserProfile.cs
Solution 2:
I am using this Google API to get avatar from google for time being. From google plugin, you can create a helper function inside AndroidClient class for getting image from Android which would return you a URI.
Solution 3:
Question answered by Tomov on this SO question worked for me with plugin version 0.10.12.
Solution 4:
if (Social.localUser.authenticated && Social.localUser.image != null)
{
GameObjectUserAvatar= GameObject.FindGameObjectWithTag("UserAvatar");
if (UserAvatar != null)
UserAvatar.GetComponent<Image>().sprite = Sprite.Create(Social.localUser.image, newRect(0, 0, 50, 50), newVector2(0, 0));
}
Post a Comment for "Social.localuser.image Returns Null In Unity3d"