Introduction:
I was looking around for a while on how to properly integrate PlayFab into Unreal Engine. After trying the PlayFab C++ SDK, with little luck as my c++ skills need work, I found Ufna’s VaRest plugin. What a godsend. I used his JsonObject and JsonValueObjects but completely revamped the calls. With this plugin you can use one node to make the request and get back a response when it is received. Below is how to set it up and use it.
Installation:
To install the plugin, download the development fork from HERE.
Next, copy the contents into <Game>/Plugins/PlayFab. You will need a c++ game for now. Next go to your uproject file, right click and select “Generate Visual Studio Files”. Then open up the visual studio project file and move into “Setup”.
Setup:
To use the PlayFab plugin you need to have an account with PlayFab, setup your title and have AppIds for that Title. You can find out all about that process HERE.
Navigate to the c++ file located in “Games/<Project>/Plugins/PlayFab/Source/PlayFab/Private/PlayFabRequestProxy.cpp”. Next open the file and near the top there are 7 FStrings that need to be updated to match your AppId.
- Change the <AppId> text in the URL to match your AppId.
- Chage the <AppId> to match your AppId.
- Input your AppId between " ".
- Input your secret key between " ".
- If you are using the photon services through PlayFab enter the corresponding AppId between " ".
- If you are using the photon services through PlayFab enter the corresponding AppId between " ".
- If you are using the photon services through PlayFab enter the corresponding AppId between " ".
Here is a picture of the code.
You are finished with the setup now rebuild your game and open up the Editor.
Demo:
To use the plugin all you do is drag an API call onto your Event Graph. The API calls can be found under PlayFab and then either Client or Server as can seen in the image below.
Attach the node to an event, pass in the required variables and then attach whatever you want to handle the response up to the graph like below.
That is all it takes! The PlayFab nodes will send out the API call, wait for a response and pass back the response from the PlayFab servers. Take a look at their documentation to see what each API call returns and expects.
I hope this helps anyone interested in using the awesome services provided by PlayFab.
- Josh