Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • Bugs /
avatar image
Question by rosscogamesbusiness · Oct 19, 2017 at 05:29 PM · unity3dAuthenticationphoton

How do I fix this error regarding PlayFabAuthManager in the Unity PlayFab SDK?

I am trying to make a user account system for my Unity3D game. I have the basics of the UI all done, I just need the functionality to work. When I try to use "PlayFabAuthManager" following the "Unity Player Login" tutorial on YouTube, I get this error:

"error CS0246: The type or namespace name `PlayFabAuthManager' could not be found. Are you missing an assembly reference?"


Here is the YouTube video: https://www.youtube.com/watch?v=QPRqaRQ4K7g&t=1362s


Here is my code: (the problem is around line 63, and repeats on lines 154 and 160)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
using System.Text;
using System.Security.Cryptography;
using PlayFab;
using PlayFab.ClientModels;
using PlayFab.Events;


public class Register : MonoBehaviour {


	public GameObject username;
	public GameObject email;
	public GameObject password;
	public GameObject confPassword;


	public string Username;
	public string Email;
	public string Password;
	public string ConfPassword;


	public string form;
	private bool emailValid = true;


	public string path = @"C:\AccountInformation\";


	public string key;


	public Text LogInErrorText;


	public enum LinkTypes {
		PlayFab = 0,
		Facebook = 1,
		Google = 2,
		Steam = 3,
		Kongregate = 4,
		Custm = 5,
		Ios = 6,
		Android = 7,
		None = -1
	};


	public string TitleId;


	public static UserAccountInfo AccountInfo;


	public WebRequestType PlayFabRequestType = WebRequestType.HttpWebRequest;


	public delegate void PlatformCheckCompleteHandler (LinkTypes linkType);
	public static event PlatformCheckCompleteHandler OnPlatformCheckComplete;


	public delegate void PlayFabReturnPlayerCheckCompleteHandler (LinkTypes linkType);
	public static event PlayFabReturnPlayerCheckCompleteHandler OnReturnPlayerCheckComplete;


	public delegate void PlayFabAuthenticationCompleteHandler (LinkTypes linkType, LoginResult result);
	public static event PlayFabAuthenticationCompleteHandler OnPlayFabAuthComplete;


	public delegate void PlayFabAuthenticationErrorHandler (LinkTypes linkType, LoginResult result);
	public static event PlayFabAuthenticationErrorHandler OnPlayFabAuthError;


	public static PlayFabAuthManager Instance { get; private set; }


	void Start () {
		
	}


	void Update () {
		Username = username.GetComponent<InputField> ().text;
		Password = password.GetComponent<InputField> ().text;
		Email = email.GetComponent<InputField> ().text;
		ConfPassword = confPassword.GetComponent<InputField> ().text;
		PlayFabSettings.TitleId = TitleId;
	}


	public void RegisterButton () {
		Debug.Log ("Attempting");
		bool UN = false;
		bool EM = false;
		bool PW = false;
		bool CPW = false;


		if (Username == "") {
			Debug.Log ("Username field empty");
		} else {
			if (File.Exists (path + Username + ".txt")) {
				Debug.Log ("Username taken");
			} else {
				UN = true;
			}
		}


		if (Password == "") {
			Debug.Log ("Password field empty");
		} else {
			key = Password;
			//Password = Encrypt (Password);
			PW = true;
		}


		if (ConfPassword == "") {
			Debug.Log ("Confirm pass field empty");
		} else {
			if (ConfPassword != Password) {
				Debug.Log ("Passwords don't match");
			} else {
				CPW = true;
			}
		}


		if (Email == "") {
			Debug.Log ("Email field empty");
		} else {
			if (Email.Contains ("@") && Email.Contains (".")) {
				Email = Encrypt (Email);
				EM = true;
			} else {
				Debug.Log ("Email address invalid format");
			}
		}


		if (UN == true && EM == true && PW == true && CPW == true) {
			/*string info = (Username + "\n" + Password + "\n" + Email);
			File.WriteAllText (path + Username + ".txt", info);*/


			RegisterAccount ();
		}
	}


	private string Encrypt (string pass) {
		System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
		byte[] bs = System.Text.Encoding.UTF8.GetBytes(pass);
		bs = x.ComputeHash(bs);
		System.Text.StringBuilder s = new System.Text.StringBuilder();
		foreach (byte b in bs) {
			s.Append(b.ToString("x2").ToLower());
		}
		return s.ToString();
	}


	public void RegisterAccount () {
		var loginRequest = new LoginWithPlayFabRequest () {
			TitleId = PlayFabSettings.TitleId,
			Username = Username,
			Password = Password
		};


		PlayFabClientAPI.LoginWithPlayFab (loginRequest, (result) => {
			LoginRegisterSuccess (result.PlayFabId);
		}, (error) => {
			LogInErrorText.text = error.ErrorMessage;
			LogInErrorText.gameObject.SetActive(true);
			PlayFabErrorHandler.HandlePlayFabError(error);


		});
	}


	public void LoginRegisterSuccess (string PlayFabId){
		PlayFab.PlayFabAuthManager.PlayFabId = PlayFabId;
		LogInErrorText.gameObject.SetActive (false);
	}
}
Comment

People who like this

0 Show 1
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rosscogamesbusiness · Oct 16, 2017 at 11:55 PM 0
Share

Update: lines 79, 182, and 190, not the other three lines I specified.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Oct 19, 2017 at 05:35 PM

That specific error means that something's invalid in the project setup. A few questions:

What version of the SDK are you using?

How are you setting up your project - do you clone the SDK, download as a Zip, etc.?

If you Clone the SDK (do not unpack the Unitypackage, as that would then duplicate files) and move over only your game's files, are you able to build?

Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rosscogamesbusiness · Oct 21, 2017 at 12:32 AM 0
Share

I am using the latest SDK version (2.29.171016), I downloaded the SDK and the Editor Extensions as the .unitypackage files. I am able to build without the SDK and have done in the past.

avatar image Brendan ♦♦ rosscogamesbusiness · Oct 21, 2017 at 08:13 PM 0
Share

And if you start a new project, clone the SDK but do not unpack the unitypackage, and move over your game files, does that build?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    "Authentication - Login With Google Account" docs and Unity SDK are missing the "AccessToken" variable 3 Answers

    Unaable to use playfab extension. 2 Answers

    Weird Bug on Login with Email: "Service Unavailable" 1 Answer

    Photon Custom Authentication returns weird error 1 Answer

    Can't register without an username (e-mail only) 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges