question

morganb816 avatar image
morganb816 asked

The best overloaded method match...PLEASE GOD HELP

Hey guys, Im newer to playfab and im trying to just create a simple player login and register screen. Im following along with one of the webinars done in the past. My problem arises when i get these two error messages.

Error #1: Assets/Scenes/Scripts/LoginManager.cs(28,20): error CS1502: The best overloaded method match for `PlayFab.PlayFabClientAPI.LoginWithPlayFab(PlayFab.ClientModels.LoginWithPlayFabRequest, System.Action<PlayFab.ClientModels.LoginResult>, System.Action<PlayFab.PlayFabError>, object, System.Collections.Generic.Dictionary<string,string>)' has some invalid arguments

Error #2: Assets/Scenes/Scripts/LoginManager.cs(28,52): error CS1503: Argument `#2' cannot convert `void' expression to type `System.Action<PlayFab.ClientModels.LoginResult>'

And here is the code i've written

.

public void Login()
	{
		var loginRequest = new LoginWithPlayFabRequest ()
		{
			TitleId = PlayFabSettings.TitleId,
			Username = userName.text,
			Password = passWord.text
		};
		PlayFabClientAPI.LoginWithPlayFab (loginRequest, loginDisplay() , print("Login faliure"));
	}

Could this be a problem with my PlayFab SDK instalation? I feel i have a decent grasp of how you write the api so im 75% sure its not my code...

Thanks in advance!

-Morgan

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The problem is the way the callbacks are being defined. What I'd recommend is creating actual callback functions, along the lines of:

private void OnLoginSuccess(LoginResult result) {
    //your logic here
}
private void OnLoginError(PlayFabError error) {
    //your logic here
}

Alternately, you could use a lambda to do the logic in-line, if you prefer. For example:

PlayFabClientAPI.LoginWithPlayFab(loginRequest,
    (result) => { loginDisplay(); },
    (error) => { print("Login faliure"); }
);
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

morganb816 avatar image morganb816 commented ·

Jeez comin in with the quick answer!

Thank you. I was wondering about that in the webinar i overlooked it as just a option of how to write out the results.

On a side note is PlayFab doing well? it seems most webinars and overall marketing kind of dipped off back in early 2016.

0 Likes 0 ·
brendan avatar image brendan morganb816 commented ·

Heh. Victims of our success is what that reflects. :)

We're working on doing more videos (and we're working on a better cadence of blog posts) now, but because of how busy we've been (over 1K live titles, 80M MAU), we've let those slide a bit. We have added more tutorials (https://api.playfab.com/docs/tutorials), but I know some folks are more visual learners, so we'll get those posted as soon as we can.

Oh, but we never really did marketing, apart from being at conferences. Look for us at GDC 2018 - we're having fun planning out the new booth (if you didn't get to play Unicorn Toss this year, don't worry - we'll have another game next year), and we'll have the full team there again.

1 Like 1 ·
morganb816 avatar image morganb816 brendan commented ·

Haha awesome. One final annoyance. (im sure i sound like a gigantic noob).

is there a way to get playfab specific errors to come back in console? my code is fine now but its still coming back as a failiure...

	public void Register ()
	{
		var registerRequest = new RegisterPlayFabUserRequest () {
			TitleId = PlayFabSettings.TitleId,
			Username = username.text,
			Password = password.text,
			Email = email.text,
		};
		PlayFabClientAPI.RegisterPlayFabUser (registerRequest, (result) => {registerSuccess(); }, (error) => {registerFailiure();});
	}	
	private void registerSuccess()
	{
		registerd.SetActive (true);
	}
	private void registerFailiure()
	{
		print ("Registration Failiure");
		//PRINT PLAYFAB ERROR HERE.
	}

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.