question

kevin-6 avatar image
kevin-6 asked

Splitting title into two titles

We currently have two live Unity games which are pointing to the same Title ID and are trying to split them into 1 title per app. Ideally, we'd be able to setup a new title ID and have the user connect to the new title and request the PlayerData(title) from the previous title. GetUserData() doesn't expose the title ID as a parameter. Is there a suggested workflow for this or is the only option to set the title id before and after the GetPlayerData request?

Example:
Set TitleID for corrected Title
User Login
Set TitleID for old title
Request PlayerData()
Set TitleID for for corrected Title

Player Data
10 |1200

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

brendan avatar image
brendan answered

Yes, if you have to separate Title IDs, and you didn't save the data to player publisher data (which is shared across titles), you would need to sign into title 1, read the data, and sign into title 2 to write the data.

3 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.

kevin-6 avatar image kevin-6 commented ·

If all the titles are under the same studio is there a login needed to each title before requesting the player data or can we login once and request the player data from each title?

0 Likes 0 ·
brendan avatar image brendan kevin-6 commented ·

The login API calls are logging you into a specific Title ID. You can request the player's publisher data (which lives at the Publisher ID/Master Player Account level) from any login, but the player title data is specific to each individual title.

0 Likes 0 ·
kevin-6 avatar image kevin-6 commented ·

I realized that the UnityWebRequest URLEncodes the body of the request when using their post method. Setting up the post manually resolved my issue.

https://answers.unity.com/questions/1163204/prevent-unitywebrequestpost-from-url-encoding-the.html

0 Likes 0 ·
kevin-6 avatar image
kevin-6 answered
Would it be possible to send a Raw HTTP Post as a workaround to get the title data from another title?  There's a post from several years ago using the system webrequest, but I'm having issues using unity's web request API.  


https://community.playfab.com/questions/740/209068388-Calling-API-Manually-with-Raw-HTTP.html


We're referencing the server doc on executing a cloud scroipt event, which doesn't require a sessionTicket.  Unless the doc is outdated?


https://api.playfab.com/documentation/Server/method/ExecuteCloudScript


		Dictionary<string, object> payload = new Dictionary<string, object>();
		payload["PlayfabID"] = playFabID;
		payload["FunctionName"] = "SendGameEventWorkAround";
		payload["FunctionParameter"] = new { event_data = data };
		payload["RevisionSelection"] = "Live";
		payload["GeneratePlayStreamEvent"] = false;


		string requestBody = PlayFab.Json.JsonWrapper.SerializeObject(payload);


		UnityEngine.Networking.UnityWebRequest request = UnityEngine.Networking.UnityWebRequest.Post(string.Format("https://{0}.playfabapi.com/Client/ExecuteCloudScript", "TITLE_ID"), requestBody);
		request.SetRequestHeader("Content-Type", "application/json");
		request.SetRequestHeader("X-SecretKey", "REDACTED_KEY");
		request.timeout = 10;
		UnityEngine.Networking.UnityWebRequestAsyncOperation op = request.SendWebRequest();
		yield return op;
		if (op.webRequest.isHttpError || op.webRequest.isNetworkError)
		{
			Debug.Log("Error sending event to playfab:" + op.webRequest.error);
		}
		else
		{
			Debug.Log("Request completed successfully");
		}


Trying to send with PostMan as well, but having trouble getting this to function 
1 comment
10 |1200

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

brendan avatar image brendan commented ·

For Client API calls, you do need to have a valid session ticket to do anything other than login and password reset.

0 Likes 0 ·

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.