Custom and Built-In PlayFab functions wrapped in a single script, with easy and accessible methods
Player π:
- Login Using Oculus (Custom made, uses CloudScript)
- Login From Unity
- Player Ban Info
- Player Inventory Management
- Player Currency Management (Multiple currencies support)
- Player PlayFab Username Management
- Title Player Data Management
- Remove Currency From Player (CloudScript)
Title π:
- Title Data Management
Economy πΈ:
- Multiple currencies support
- Economy Catalogs Management
- Economy Items Management
- Items Purchasing (Using PlayFab)
- Player Item Granting (CloudScript)
- Add Currency To Player (CloudScript)
- Remove Currency From Player (CloudScript)
Multiplayer (Photon PUN) π₯:
- PlayFab Authentication
- Oculus and PlayFab Authentication
Oculus π₯½:
- IAP Purchase Consumption
Other π¨
- A small PlayFabManager sample
- Debug/Test Mode (With buttons, etc.)
- Download and import PlayFab Unity SDK and PlayFab Editor Extensions
- When imported, open PlayFab Editor Extensions window by going in Window -> PlayFab -> Editor Extensions, login, and choose your studio and title
- After thats done, download PlayFab Wrapper Unity Package from Releases, and import its content into your Project
- Create an Empty Game Object in the root of your Hierarchy, name it PlayFabManager, and put a PlayFabWrapper script on it
Additionally: If you are a VR Developer, its recommended to also use my OculusSDKWrapper
Additionally: if you want to try out a small sample, put a PlayFabManagerSample script onto where your PlayFabWrapper script is. In our case, its on PlayFabManager object
To get PlayFabWrapper working we need to configure our PlayFab Title first
- (Ignore if you already have an existing title you want to use) Go to PlayFab Website, login, and create a new title by press 3 dots on next to your Studio and press New Title
- After you have a Title, press gear icon next to your Title name, and click Title Settings
- Go to API Features tab, scroll down and click (check) "Allow client to view ban reason and duration"
- After that, go to Secret Keys tab, select all existing secret keys, and press Delete
- Next, look on the right side of your the dashboard, and click on Automation, then Revisions (Legacy)
-
Select all code inside (Win: CTRL + A | Mac: CMD + A), and delete it
-
Now, scroll back up, find and open CloudScripts file, select and copy EVERYTHING (all code) inside of it
-
Go back to the Revisions (Legacy) page, and paste all copied code inside of it
-
Go to Meta Quest Developer Dashboard, open your App, and find API tab, open it, and copy your App ID, and App Secret (Do not tell anybody your App Secret!)
-
In VerifyOculusPlayer and ConsumeIAP cloudscripts, find words "appidhere" and "appsecrethere" IN the links, and put your App ID and App Secret instead of them
-
After the code is pasted, press Upload new revision, click Deploy this revision after save, and the press Save and deploy. After that, CloudScripts are set up
Additionally: To use Economy features, you can create Catalogs, Items, and Currency for your PlayFab Title, by following these official guides:
PlayFabWrapper.instance.PlayFabID
is the PlayFab ID
Saves:
- Saves PlayFab ID in the instance (
PlayFabID
type ofstring
) - Saves PlayFab Display Name in the instance (
PlayerAccountName
type ofstring
) Example Usage:
PlayFabWrapper.LoginWithOculus(r => {
//success
}, e => {
//error
});
Saves:
- Saves PlayFab ID in the instance (
PlayFabID
type ofstring
) - Saves PlayFab Display Name in the instance (
PlayerAccountName
type ofstring
) Example Usage:
PlayFabWrapper.LoginFromUnity(r => {
//success
}, e => {
//error
});
Saves:
- Saves owned currencies and their amounts in the instance (
OwnedCurrencyAmount
type ofDictionary<string, int>
) - Saves Items Owned by the Player in the instance (
PlayerOwnedItems
type ofList<string>
) Example Usage:
PlayFabWrapper.GetUserInventoryAndCurrency(r => {
//success
}, e => {
//error
});
Saves:
- Saves PlayFab Display Name in the instance (
PlayerAccountName
type ofstring
) Example Usage:
PlayFabWrapper.SetPlayerDisplayName("exampleName", r => {
//success
}, e => {
//error
});
Example Usage:
Dictionary<string, string> data_ = new(){
{ "example", "test" }
}
PlayFabWrapper.SetPlayerData(data_, r => {
//success
}, e => {
//error
});
Saves:
- Saves received Title Player Data in the instance (
TitlePlayerData
type ofDictionary<string, string>
)
Example Usage:
PlayFabWrapper.GetPlayerData("PlayFabId", r => {
//success
}, e => {
//error
});
Saves:
- Saves received Title Data in the instance (
TitleData
type ofDictionary<string, string>
)
Example Usage:
PlayFabWrapper.GetTitleData(r => {
//success
}, e => {
//error
});
Saves:
- Saves received Catalog and its Items infos in the instance (
ItemsAndPrices
type ofList<CatalogInfo>
)
Example Usage:
PlayFabWrapper.GetCatalogAndPrices("TestCatalog", r => {
//success
}, e => {
//error
});
(Price is set automatically, from the catalog that you got)
Example Usage:
PlayFabWrapper.PurchaseItem("TestCatalog", "MyItem", "AB", r => {
//success
}, e => {
//error
});
Example Usage:
PlayFabWrapper.GrantItemToPlayer("PlayFabId", "TestCatalog", "MyItem", r => {
//success
}, e => {
//error
});
Example Usage:
PlayFabWrapper.AddCurrencyToPlayer("PlayFabId", "AB", 100, r => {
//success
}, e => {
//error
});
Example Usage:
PlayFabWrapper.RemoveCurrencyFromPlayer("PlayFabId", "AB", 100, r => {
//success
}, e => {
//error
});
Automatically connects to Photon Pun after authenticated
Example Usage:
PlayFabWrapper.AuthenticatePhotonWithPlayFab("PlayFabId", r => {
//success
}, e => {
//error
});
Automatically connects to Photon Pun after authenticated
Example Usage:
PlayFabWrapper.AuthenticatePhotonWithPlayFabAndOculus("PlayFabId", r => {
//success
}, e => {
//error
});
Example Usage:
PlayFabWrapper.ConsumeOculusConsumablePurchase("exampleSku", r => {
if(r){
//Consume success
} else {
//Consume error
}
});
You can contribute by suggesting changes, fixes, and new functiononality by suggesting it in #general
channel in my discord
- PlayFabWrapper - superpanos (me)
- Testing - superpanos (me)
- Oculus Graph API CloudScripts - JokerJosh EasyPlayFab