question

admin-9 avatar image
admin-9 asked

Server API in Unity SDK,

I am using PlayFab for authentication and User management in side a SpatialOS Game. I want to be able to call methods from my SpatialOS Server in side Unity3d but I am seeing none of that in the SDK anymore. Is it still there and if so how would I go about accessing it?

,
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

If you're building a project which is intended to be a server (and won't be exposed to players), you should turn on the Server API in the Unity SDK via the Editor Extensions (https://github.com/PlayFab/UnityEditorExtensions).

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.

admin-9 avatar image admin-9 commented ·

I've done that and there is still nothing in there about Server related calls. It just seems to freeze the Editor Extension, then it recompiles the code but when I check to see if the server stuff is there it isn't. I'm using Unity 5.6.0f3 if that makes any difference.

0 Likes 0 ·
admin-9 avatar image admin-9 commented ·

Also I am following this integration tutorial - https://docs.improbable.io/reference/12.0/workers/unity/playfab-integration

Where you build the Server and Client in the same project they say to put the developer secret key in through a console argument so the Client doesn't have access to the Developer Secret Key. Is that still possible?

PlayFabSettings.DeveloperSecretKey =
CommandLineUtil.GetCommandLineValue(Environment.GetCommandLineArgs(), "playFabSecret", "");
0 Likes 0 ·
brendan avatar image brendan admin-9 commented ·

When it appears to "freeze", that sounds like you're rebuilding the code. But if you're not seeing the Server API methods as being available in the project, that sounds like the Server API selection isn't actually getting set, so I'd close the project, re-load it, and double check the setting in the editor extension. In particular, check that the "Scripting Define Symbols" has been updated, too. If not, something's preventing the extensions from working as designed.

I'm not really familiar with Improbable's sample, but it looks like in their model, the Secret Key is stored in their service and only passed to the application for use in the Server API calls in the case where you want it to be available (when it's running on a server you control). If that's the case, that's fine, but again, I'd make sure that your code doesn't attempt to call the Server API endpoints when you don't have the Secret Key, so that you don't have an issue where a client is determined to be a hacker trying to mess with the title.

0 Likes 0 ·
Edward John S Lacap avatar image
Edward John S Lacap answered

@lowfitcorp1

10 |1200

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

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.