This issue occurred on the new Unity 5.5b07, which we are forced to use due to some critical new features. It is an error that stops you from being able to run the game at all.
Assets/GooglePlayGames/ISocialPlatform/PlayGamesLocalUser.cs(27,18): error CS0535: `GooglePlayGames.PlayGamesLocalUser' does not implement interface member `UnityEngine.SocialPlatforms.ILocalUser.Authenticate(System.Action<bool,string>)'
5.5 is still in beta, so we haven't done too much with it. The quick fix is to implement the new method in PlayGamesLocalUser (and feel free to submit a Pull Request).
Ok will do.
So how would that implementation look like? Can i get a code sample. pretty please
Hey @EvilBook , you can do this by simply editing the methods in the code for PlayGamesServices and then committing them back to the main repo. We've downgraded to b07 for other reasons, so I will not get around to do it for a while. Feel more than welcome to do it. If you right click on the method that is causing the issue, you can simply edit the method signature and follow derivative methods until the parameter no longer needs to be passed along. I think the only difference is that the new unity social API wants an error message, not just a success or a fail (they added a string). For now you can just add "error" or "success" as a string until google decides to do the feature.
Also if @claywilkinson knows if such error string is currently given by the library, and how we can get it, we can replace "success" and "error" with the actual message. If it's even given atm.
Any update on this issue?
Nevermind, I fixed it myself using PimDeWitte's suggestion.
@Kidel , can you provide what you have changed please, i do not quite understand
Basically if you follow the error on Visual Studio or Monodevelop you'll find that a certain function has an argument that is (Action
Action
(then passing c as callback of course).
hi, i still didn't understood it , please help , i only know the basics of programming but i have to submit an update of my app with play services in it. please can someone fix it for me here is the code
`//
// Copyright (C) 2014 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
namespace GooglePlayGames
{
using System;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
/// <summary>
/// Represents the Google Play Games local user.
/// </summary>
public class PlayGamesLocalUser : PlayGamesUserProfile, ILocalUser
{
internal PlayGamesPlatform mPlatform;
private string emailAddress;
private PlayerStats mStats;
internal PlayGamesLocalUser(PlayGamesPlatform plaf)
: base("localUser", string.Empty, string.Empty)
{
mPlatform = plaf;
emailAddress = null;
mStats = null;
}
/// <summary>
/// Authenticates the local user. Equivalent to calling
/// <see cref="PlayGamesPlatform.Authenticate" />.
/// </summary>
public void Authenticate(Action<bool> callback)
{
mPlatform.Authenticate(callback);
}
/// <summary>
/// Authenticates the local user. Equivalent to calling
/// <see cref="PlayGamesPlatform.Authenticate" />.
/// </summary>
public void Authenticate(Action<bool> callback, bool silent)
{
mPlatform.Authenticate(callback, silent);
}
/// <summary>
/// Loads all friends of the authenticated user.
/// </summary>
public void LoadFriends(Action<bool> callback)
{
mPlatform.LoadFriends(this, callback);
}
/// <summary>
/// Synchronous version of friends, returns null until loaded.
/// </summary>
public IUserProfile[] friends
{
get
{
return mPlatform.GetFriends();
}
}
/// <summary>
/// Gets an id token for the user.
/// NOTE: This property can only be accessed using the main Unity thread.
/// </summary>
/// <param name="idTokenCallback"> A callback to be invoked after token is retrieved. Will be passed null value
/// on failure. </param>
[Obsolete("Use PlayGamesPlatform.GetServerAuthCode()")]
public void GetIdToken(Action<string> idTokenCallback)
{
if(authenticated)
mPlatform.GetIdToken(idTokenCallback);
else
idTokenCallback(null);
}
/// <summary>
/// Returns whether or not the local user is authenticated to Google Play Games.
/// </summary>
/// <returns>
/// <c>true</c> if authenticated; otherwise, <c>false</c>.
/// </returns>
public bool authenticated
{
get
{
return mPlatform.IsAuthenticated();
}
}
/// <summary>
/// Not implemented. As safety placeholder, returns true.
/// </summary>
public bool underage
{
get
{
return true;
}
}
/// <summary>
/// Gets the display name of the user.
/// </summary>
/// <returns>
/// The display name of the user.
/// </returns>
public new string userName
{
get
{
string retval = string.Empty;
if (authenticated)
{
retval = mPlatform.GetUserDisplayName();
if (!base.userName.Equals(retval))
{
ResetIdentity(retval, mPlatform.GetUserId(), mPlatform.GetUserImageUrl());
}
}
return retval;
}
}
/// <summary>
/// Gets the user's Google id.
/// </summary>
/// <remarks> This id is persistent and uniquely identifies the user
/// across all games that use Google Play Game Services. It is
/// the preferred method of uniquely identifying a player instead
/// of email address.
/// </remarks>
/// <returns>
/// The user's Google id.
/// </returns>
public new string id
{
get
{
string retval = string.Empty;
if (authenticated)
{
retval = mPlatform.GetUserId();
if (!base.id.Equals(retval))
{
ResetIdentity(mPlatform.GetUserDisplayName(), retval, mPlatform.GetUserImageUrl());
}
}
return retval;
}
}
/// <summary>
/// Gets an access token for the user.
/// NOTE: This property can only be accessed using the main Unity thread.
/// </summary>
/// <returns>
/// An id token for the user.
/// </returns>
[Obsolete("Use PlayGamesPlatform.GetServerAuthCode()")]
public string accessToken
{
get
{
return authenticated ? mPlatform.GetAccessToken() : string.Empty;
}
}
/// <summary>
/// Returns true (since this is the local user).
/// </summary>
public new bool isFriend
{
get
{
return true;
}
}
/// <summary>
/// Gets the local user's state. This is always <c>UserState.Online</c> for
/// the local user.
/// </summary>
public new UserState state
{
get
{
return UserState.Online;
}
}
public new string AvatarURL
{
get
{
string retval = string.Empty;
if (authenticated)
{
retval = mPlatform.GetUserImageUrl();
if (!base.id.Equals(retval))
{
ResetIdentity(mPlatform.GetUserDisplayName(),
mPlatform.GetUserId(), retval);
}
}
return retval;
}
}
/// <summary>Gets the email of the signed in player.</summary>
/// <remarks>If your game requires a persistent, unique id for the
/// player, the use of PlayerId is recommendend since it does not
/// require extra permission consent from the user.
/// This is only available if the Requires Google Plus option
/// is added to the setup (which enables additional
/// permissions for the application).
/// NOTE: This property can only be accessed using the main Unity thread.
/// </remarks>
/// <value>The email.</value>
public string Email
{
get
{
// treat null as unitialized, empty as no email. This can
// happen when the web client is not initialized.
if (authenticated && string.IsNullOrEmpty(emailAddress))
{
emailAddress = mPlatform.GetUserEmail();
emailAddress = emailAddress ?? string.Empty;
}
return authenticated ? emailAddress : string.Empty;
}
}
/// <summary>
/// Gets the player's stats.
/// </summary>
/// <param name="callback">Callback when they are available.</param>
public void GetStats(Action<CommonStatusCodes, PlayerStats> callback)
{
if (mStats == null || !mStats.Valid)
{
mPlatform.GetPlayerStats((rc, stats) =>
{
mStats = stats;
callback(rc, stats);
});
}
else
{
// 0 = success
callback(CommonStatusCodes.Success, mStats);
}
}
}
}
`
No problem, here is what I did (tested on Android, still not on iOS, be aware of that):
in GooglePlayGames\ISocialPlatform\PlayGamesLocalUser.cs
``` c#
public void Authenticate(Action
{
mPlatform.Authenticate(callback);
}
in **GooglePlayGames\ISocialPlatform\PlayGamesPlatform.cs**
``` c#
public void Authenticate(Action<bool,string> callback)
{
Authenticate(callback, false, "auth error");
}
public void Authenticate(Action<bool,string> callback, bool silent, string message)
{
// make a platform-specific Play Games client
if (mClient == null)
{
GooglePlayGames.OurUtils.Logger.d(
"Creating platform-specific Play Games client.");
mClient = PlayGamesClientFactory.GetPlatformPlayGamesClient(mConfiguration);
}
// authenticate!
Action<bool> c = (bool a) => callback(a, message);
mClient.Authenticate(c, silent);
}
public void Authenticate(ILocalUser unused, Action<bool,string> callback)
{
Authenticate(callback, false, "auth error");
}
Thank You @Kidel for replying to my problem, but it didn't worked :'(
i replaced this in GooglePlayGames\ISocialPlatform\PlayGamesLocalUser.cs
public void Authenticate(Action<bool> callback)
{
mPlatform.Authenticate(callback);
}
with this
public void Authenticate(Action<bool,string> callback)
{
mPlatform.Authenticate(callback);
}
and in GooglePlayGames\ISocialPlatform\PlayGamesPlatform.cs i replaced this
` public void Authenticate(Action
{
Authenticate(callback, false);
}
public void Authenticate(Action<bool> callback, bool silent)
{
// make a platform-specific Play Games client
if (mClient == null)
{
GooglePlayGames.OurUtils.Logger.d(
"Creating platform-specific Play Games client.");
mClient = PlayGamesClientFactory.GetPlatformPlayGamesClient(mConfiguration);
}
// authenticate!
mClient.Authenticate(callback, silent);
}
public void Authenticate(ILocalUser unused, Action<bool> callback)
{
Authenticate(callback, false);
}`
with this
` public void Authenticate(Action
{
Authenticate(callback, false, "auth error");
}
public void Authenticate(Action<bool,string> callback, bool silent, string message)
{
// make a platform-specific Play Games client
if (mClient == null)
{
GooglePlayGames.OurUtils.Logger.d(
"Creating platform-specific Play Games client.");
mClient = PlayGamesClientFactory.GetPlatformPlayGamesClient(mConfiguration);
}
// authenticate!
Action<bool> c = (bool a) => callback(a, message);
mClient.Authenticate(c, silent);
}
public void Authenticate(ILocalUser unused, Action<bool,string> callback)
{
Authenticate(callback, false, "auth error");
}`
did i did it right ? i think not because now there are 4 errors. what should i do ? please help.
can you please provide the script that you used ?
I never said to replace.
Thanks @Kidel ,it worked thank you so much, you took a big burden out of my head.
Hi @Kidel, Today unity release unity 5.5. I faced the same issue up there but still have problems.
I did your fix but now a new bunch of errors appears with it.
-1
Assets/GooglePlayGames/ISocialPlatform/PlayGamesLocalUser.cs(58,23): error CS1502: The best overloaded method match for `GooglePlayGames.PlayGamesPlatform.Authenticate(UnityEngine.SocialPlatforms.ILocalUser, System.Action
-2
Assets/GooglePlayGames/ISocialPlatform/PlayGamesLocalUser.cs(58,36): error CS1503: Argument #1' cannot convertSystem.Action
-3
Assets/GooglePlayGames/ISocialPlatform/PlayGamesLocalUser.cs(27,18): error CS0535: GooglePlayGames.PlayGamesLocalUser' does not implement interface memberUnityEngine.SocialPlatforms.ILocalUser.Authenticate(System.Action
-4
Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs(337,13): error CS1502: The best overloaded method match for `GooglePlayGames.PlayGamesPlatform.Authenticate(UnityEngine.SocialPlatforms.ILocalUser, System.Action
-5
Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs(337,26): error CS1503: Argument #1' cannot convertSystem.Action
-6
Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs(41,18): error CS0535: GooglePlayGames.PlayGamesPlatform' does not implement interface memberUnityEngine.SocialPlatforms.ISocialPlatform.Authenticate(UnityEngine.SocialPlatforms.ILocalUser, System.Action
I really apreciate any help you can bring to me.!
Thanks
Official Unity 5.5 was just released today. Will there be an update to the official Google SDK?
I updated my unity to 5.5 and got the same error then followed what @Kidel said and it worked for me..
public void Authenticate(Action
{
mPlatform.Authenticate(callback);
}
// add below
public void Authenticate(Action
{
mPlatform.Authenticate(callback);
}
//
@createoh yes, you are right !
Kidel's " i never said to replace " means that you have to add what he told and not to replace. I did what he said and it worked perfectly.
If anyone still having the problem you can msg me on gmail : [email protected]
And i will send you the scripts : )
# HI GUYS... thanks u all for ur replies!! yes my fault... I actually replace the info instead of add the other one.!
Now its works fine to me.
Thanks :)
If you are still trying to find a solution for this, and the answers above don't work for you.
Here's what I did:
On PlayGamesLocalUser:
public void Authenticate(Action
{
//mPlatform.Authenticate(callback);
}
On PlayGamesPlatform:
//Temporal fix for error on implementation
public void Authenticate(ILocalUser x, Action
{
//mPlatform.Authenticate(callback);
}
This has been fixed in version 0.9.36 of the plugin.
Most helpful comment
No problem, here is what I did (tested on Android, still not on iOS, be aware of that):
in GooglePlayGames\ISocialPlatform\PlayGamesLocalUser.cs
``` c# callback)
public void Authenticate(Action
{
mPlatform.Authenticate(callback);
}