question

Mr Sham avatar image
Mr Sham asked

Is uploading .prefab to file are correct flow?

"Contents": [ { "Id": "c387fc61-9881-4d5d-b1cb-fedec5222187", "MaxClientVersion": null, "MinClientVersion": null, "Tags": [ "" ], "Type": "prefab", "Url": "https://content1.prod.catalog.playfab.com/pf-title-cc3ff0c58f0d7b77-de34a/c387fc61-9881-4d5d-b1cb-fedec5222187/navigation_target.prefab" }, { "Id": "17e1066f-4986-4a05-82b2-0d73eaddbaa6", "MaxClientVersion": null, "MinClientVersion": null, "Tags": [ "" ], "Type": "icon", "Url": "https://content1.prod.catalog.playfab.com/pf-title-cc3ff0c58f0d7b77-de34a/17e1066f-4986-4a05-82b2-0d73eaddbaa6/redFlag.png" } ]

I have contents above using Search api with "Select", however I am struggling to load the prefab into unity? sorry for the silly question but is it a correct approach to store .prefab into files?

Because when I try to load it with unitywebrequest I got below error.

Failed to load asset from URL: https://content1.prod.catalog.playfab.com/pf-title-cc3ff0c58f0d7b77-de34a/c387fc61-9881-4d5d-b1cb-fedec5222187/navigation_target.prefab. Error: UnityEngine.Debug:LogError (object)

apis
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

·
Infer Wang avatar image
Infer Wang answered

You can refer to the GetActualFile function in this document to download the content from the link to local to see whether it’s correct format:

 void GetActualFile(PlayFab.DataModels.GetFileMetadata fileData)
     {
         GlobalFileLock += 1; // Start Each SimpleGetCall
         PlayFabHttp.SimpleGetCall(fileData.DownloadUrl,
             result => { _entityFileJson[fileData.FileName] = Encoding.UTF8.GetString(result); GlobalFileLock -= 1; }, // Finish Each SimpleGetCall
             error => { Debug.Log(error); }
         );
     }

Then load the content into unity.

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.