Hey there, fellow gamers!
Today was quite the adventure in the world of game development for me. I stumbled upon something called PlayFab, and let me tell you, it's a game-changer (pun intended). PlayFab is this cool integrated tool for Unity that helps manage online services like player accounts, payments, and overall game management.
So, how did I stumble upon this gem? Well, I was knee-deep in developing my own video game when I realized I needed a way for players to log in and manage their accounts. That's when PlayFab came to the rescue. By integrating it into my game, I was able to create a seamless login system and effortlessly manage all the players who signed in. It was like unlocking a whole new level of game development!
What's awesome about PlayFab is how it simplifies the whole process, making it easy for developers like me to focus on creating epic gaming experiences without worrying about the nitty-gritty of backend management.
This is the code I used to integrate the login system.
public InputField email ;
public InputField password;
public GameObject panel;
public Text mailText;
public Text passwordText;
public Text ruling;
public Button registButton;
public PlayerController plc;
This here are my variables where i had my places where people could input their emails and passwords to login and my Player Controller (remember that one it's important later)
public void RegisterButton()
{
var request = new RegisterPlayFabUserRequest
{
Email = email.text,
Password = password.text,
RequireBothUsernameAndEmail = false
};
PlayFabClientAPI.RegisterPlayFabUser(request, OnLoginSucces, OnError);
void OnLoginSucces(RegisterPlayFabUserResult result)
{
Debug.Log("Succesfull login");
}
void OnError(PlayFabError error)
{
Debug.Log("Error on login, please try again");
Debug.Log(error.GenerateErrorReport());
}
email.enabled = false;
password.enabled = false;
panel.SetActive(false);
mailText.enabled = false;
passwordText.enabled = false;
ruling.enabled = false;
registButton.enabled = false;
plc.IsPlaying = true;
}
This over here is my function that activates when someone presses the register button, what it does is that it takes whatever is inside the input fields and turns it in to the playfab manager and stores it, but it also it tells the game when should my player be moving, because you dont want to be writing your email and suddenly you already lost right? (told you it was important)
So, if you're a budding game developer like me, I highly recommend checking out PlayFab. Trust me, it's a game-changer you don't want to miss out on!
Top comments (1)
Pretty cool! Looking forward to seeing whatβs next!