How to implement app42 users with unity networking?

0 votes

using UnityEngine;

using System.Collections;

 

public class NetworkConnect : MonoBehaviour {

 

// Use this for initialization

void Start () {

PhotonNetwork.ConnectUsingSettings("alpha 0.1");

 

}

 

void OnGUI(){

GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());

 

if(GUI.Button(new Rect(10, 10, 300, 50), "Random Match")){

PhotonNetwork.JoinRandomRoom();

}

 

void OnPhotonRandomJoinFailed(){

PhotonNetwork.CreateRoom(null);

}

 

void OnJoinedRoom(){

GameObject myPlayer = PhotonNetwork.Instantiate("PlayerNetwork", Vector3.zero, Quaternion.AngleAxis(180, Vector3.up), 0); 

myPlayer.gameObject.tag = "myPlayer";

PlayerMoveScript playerMove = myPlayer.GetComponent<PlayerMoveScript>();

playerMove.isPlayer = true;

}

 

}

So that's my code for connecting and spawning into the game. How would I use app42 users with this code to ensure each player has their unique username and it's attached to the backend database? This is my first time dealing with any type of database so I'm a bit overwhelmed with the process. 

Right now I have a script that creates a username, password, and emailid. What else do I need? What are the steps in doing this? I'm sorry for such newbie questions but I've done a lot of research and still feel like I'm missing something big. Any advice or help is greatly appreciated. 

asked Feb 25, 2014 in App42 Cloud API-BaaS by JoeCrill (25 points)

1 Answer

0 votes

You can get started with our tutorial page here. On downloading of SDK, you will get a sample project which you can look into for complete user managemnet. Here is a tutorial for user management that you can refer too.

 

answered Feb 26, 2014 by ajay123 (899 points)
So "profile.setCity("Houston"); "

Would I be able to set this in a different code? Say a round just finished and I want to update the user's win ammount? Would something like this work?
if (game_over && you_win)
{
    profile.setWins(profile.getWins += 1);
}
You can use storage service (http://api.shephertz.com/tutorial/Saving-App-Data/?index=storage-data) to storage user and app data.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...