androidiosunity-game-enginegoogle-play-servicesgame-center

Social.localUser.Image returns null in Unity3d


I want to access player avatar in Android and IOS, I could get userid and username using Social Class but image always returns null!!

if ( Social.localUser.authenticated && Social.localUser.image != null )
{
    Material m = new Material(Shader.Find("Unlit/Transparent Colored"));
    m.mainTexture = Social.localUser.image;
    AvatarImage.material = m;
}

Any idea.


Solution

  • 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