question

Thomas LAURENT avatar image
Thomas LAURENT asked

Unity UnitTestScene and testscene don't work, project settings resets on start

I've configured the project settings in Unity (see first capture image-114.jpg)

And when I play PlayFabSdk/PlayFabSDK/Testing/scenes/testscene.unity or PlayFabSdk/PlayFabSDK/Testing/Tests/Scenes/UnitTestScene.unity it resets my configuration (see second capture image-115.jpg) and the console displays a "UriFormatException: Invalid URI: The hostname could not be parsed." because it's trying to send a UnityWebRequest to "https://your title id here.playfabapi.com/Client/LoginWithEmailAddress?sdk=UnitySDK-2.79.191218" due to my config reset on play time.

I expected these scenes to serve me as example of requests to test the PlayFab service but it seems bugged :/

If I reconfigure the title at runtime for the next request retry to work it still doesn't work (same error, a matter of cache I guess)

I've created my own test scene with a script doing a Device Login like in this tutorial and it works great (no config reset, everything's ok), I guess I'll keep doing that.

unity3dsdkstest
image-114.jpg (156.2 KiB)
image-115.jpg (391.4 KiB)
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

·
Sarah Zhang avatar image
Sarah Zhang answered

There is a comment “More details available here: https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/testTitleData.md in this script file TestTitleDataLoader.cs. You can navigate to the page JenkinsConsoleUtility through it. In this JenkinsConsoleUtility Readme, you will see the following requirements which need to be meet before you run the test-example:

  • We highly suggest you create a test title which is exclusively for running our tests, which you will not use for your actual game development
  • In your own test title, a specific set of CloudScript functions must be appended to your own
  • They are provided here: https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/jcuCloudScript.js
  • You must be running our testing-example projects, provided with most of our sdks
  • Any sdk with semi-weekly releases should have this test project included with the SDK
  • You must provide a testTitleData.json file to the test-example
  • See the detailed described here: https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/testTitleData.md
  • You must ENABLE the "Allow client to post player statistics" option in the PlayFab Game Manager
  • PlayFab Website -> Login -> Find your title -> Settings -> API-Features -> check-box
  • For server-authoritative games, or games with leaderboards, this is not suggested, hence the importance of creating a separate title

And in this page testTitleData.md, you can find more details, like the format of the testTitleData.json file, and the Cloud Script functions which must exist in your title.

The configuration of the testing environment is designed to be separate from the production environment, so the configuration of the production environment(the configuration in PlayFab extension)should not affect this test-example. Please follow the above content before you run the UnitTestScene.

1 comment
10 |1200

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

Thomas LAURENT avatar image Thomas LAURENT commented ·

Thanks I got it working now :)
It may be misleading for newcomers like me, maybe add a warning or something for the developer experimenting with that for the first time?

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.