question

studio avatar image
studio asked

Adding Playfab to DLL in unity

Hi ,

I want to build a dll that handles all my backend integration with playfab, that I can use in a bunch of my games. I have built the dll, but cannot find way to integrate playfab inside the dll.

I have tried to add the c# sdk in to the dll but could not connect to the server without crashing unity , but I cannot use the unity sdk as it need to create a scriptable object

does any one have any ideas

unity3dsdks
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

Can you describe in a bit more detail the issues you're running into? The PlayFab API calls are simple web API endpoints at their base, so there's nothing that would prevent you from making them as part of a "core" DLL that you use across all games. In fact, we've worked with a number of our enterprise customers to integrate PlayFab as a core component in the engines they use cross-title, so we've seen this work on a number of games.

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

studio avatar image studio commented ·

thank you for the reply

I am not sure which SDK to use, I tried the unity SDK and added in the code to the dll , but each time i run the game i get an error that it could not find the playfab settings resource , do I need to manual create the class or is there a better way to do it ?

0 Likes 0 ·
brendan avatar image brendan studio commented ·

If you're using Unity, the Unity SDK is the one we'd recommend. Can you post the exact error you're getting in the build here?

0 Likes 0 ·
studio avatar image studio commented ·

Here is the error I am getting inside unity

Exception: The number of PlayFabSharedSettings objects should be 1: 0 PlayFab.PlayFabSettings.GetSharedSettingsObjectPrivate () PlayFab.PlayFabSettings.get_PlayFabSharedPrivate () PlayFab.PlayFabSettings.get_TitleId () PlayFab.PlayFabClientAPI.LoginWithCustomID (PlayFab.ClientModels.LoginWithCustomIDRequest request, System.Action`1 resultCallback, System.Action`1 errorCallback, System.Object customData, System.Collections.Generic.Dictionary`2 extraHeaders) KamiCore.Network.BackendServiceWrapper.AutoLogPlayerIn (_PlayDevice playDevice) UnityKamiCore.Awake () (at Assets/_Scripts/UnityKamiCore.cs:17)

0 Likes 0 ·
studio avatar image studio studio commented ·

If I manual create a playfab setting file in code and then add it to the playfab settings then I get the following error

Unhandled error in PlayFabWWW: Ionic.Zlib.ZlibException: Bad GZIP header. at Ionic.Zlib.ZlibBaseStream._ReadAndValidateGzipHeader () [0x00000] in <filename unknown>:0 at Ionic.Zlib.ZlibBaseStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0 at Ionic.Zlib.GZipStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0 at PlayFab.Internal.PlayFabWww+<Post>d__13.MoveNext () [0x00000] in <filename unknown>:0

So I guess that I am not filling in a setting or somethink

0 Likes 0 ·
studio avatar image studio studio commented ·

I got it all working now, had to set the compress data API flag to false, but I have to change the following line of code

private static PlayFabSharedSettings _playFabShared = null

to

internal static PlayFabSharedSettings _playFabShared = null;

is this going to break anything else in playfab or is there a better why to fix it

0 Likes 0 ·
brendan avatar image brendan studio commented ·

No, that won't break anything - but to be clear, the only reason that's necessary is because this is a separate DLL. So, for the sake of others, that's not a change you'd make for a non-DLL project.

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.