Did you find this helpful?
Using Cloud Script
This guide covers uploading and managing your Cloud Script files on PlayFab Game Manager. This guide covers writing the Cloud Script code itself.
- You should be familiar with the basics of PlayFab
- C# Samples shown in this guide correspond to using the PlayFab Unity SDK
Your First Cloud Script Revision
After creating a title, PlayFab automatically includes an example script as your first revision. This revision includes a number of methods that you can use for learning and testing Cloud Script. To see these functions, open Game Manager, select your title, and click Automation on the left side bar.
You should see a number of Cloud Script methods, such as helloWorld, which logs the message Hello PLAYERID, where PLAYERID is the current player's PlayFab ID.
Uploading your own revisions
You can upload your own custom methods via the Game Manager. Each file you upload will create a new revision. During the upload, the PlayFab service runs a simple LINT check over your Cloud Script for syntax errors. If it finds an error, an error message will be displayed. Fix the error, and click SUBMIT again. By default, new uploads must deployed by clicking the "DEPLOY REVISION # TO LIVE" link. This enables you to update or roll back to/from multiple versions of Cloud Script.
The first time you press the "UPLOAD NEW REVISION" button (orange), you will see a file selector where you can upload a file from your local machine:
After you have added several revisions, you can select which submitted revision is live with the dropdown:
You may also use GitHub to manage your Cloud Script revisions. You must have a GitHub account, and you must be logged in.
- Find the "USE GITHUB" button (grey - screenshot above)
- The next window will have a "AUTHORIZE GITHUB ACCOUNT" button (orange)
- Create a new, empty repository in GitHub
- Return to the GitHub page in PlayFab Game Manager (refresh tab)
- At this point, you should be able to select your GitHub repository and bind it to your title:
Once bound to GitHub, the manual upload option is removed, and new Cloud Script revisions are automatically made for each GitHub commit to "master" branch. If you commit multiple files, they will be concatenated together into a single PlayFab Cloud Script revision. Live-revision selection remains the same: new commits to GitHub must be set to live in Game Manager as described above.
Cloud Script allows you to upload files to PlayFab, and execute your code on our server. You can manage your Cloud Script files from Automation option in the left side bar. You can upload files manually from your own computer, or bind your title to a GitHub account.
This guide covers managing your code files and uploading them to PlayFab. If you have more questions this guide will tell you more about how to write your code files.