question

ericstock avatar image
ericstock asked

Is it safe to switch a game from using a request type of Unity Web Request to Http Web Request?

Our game has been in development for several years. We use the Unity game engine version 2019.4 LTS. We are currently using Playfab sdk version 2.69.190625. Our PlayFabSharedSettings has always been set to use the "Unity Web Request". It is my understanding that this is the default mode and uses the main unity thread.

Recently due to a performance issue we changed this setting to use "Http Web Request". My understanding is that this handles the processing of the return values from the requests in a separate thread. Immediately we began to have stability issues and lockups in our game. Specifically when we would try to close the game, it would soft lock. We also saw crashes which contained a playfab call stack. When switching back to use the "Unity Web Request" mode, these issues stopped occurring.

A quick look at the playfab code shows calls such as:

PlayFabHttp.instance.OnPlayFabApiResult(reqContainer);

When looking at the CreateInstance() function inside SingletonMonoBehaviour, we see a bunch of non-threadsafe monobehavour calls such as FindObjectsOfType and AddComponent. It seems that during initialization or shutdown these calls could be made.

I would like to ask if this "Http Web Request" mode is indeed supported and if you recommend we use it. Are there any steps we must take in order to safely use it?

apisunity3d
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

·
Rick Chen avatar image
Rick Chen answered

The UnitySDK version you used was released on Jun 26, 2019. It is old. This version was only verified working on Unity 5.6.Latest, and all versions from 2017.1.Latest to 2019.1.Latest. Please refer to https://docs.microsoft.com/en-us/gaming/playfab/release-notes/2019#190625. There are many changes to the SDK in new version, you could check them on https://github.com/PlayFab/UnitySDK/releases. Could you please update your UnitySDK to the latest version and try again? If the issue still occurs, please let us know.

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.