GLTFUtility icon indicating copy to clipboard operation
GLTFUtility copied to clipboard

How to Load .glb files on a WebGL build, from StreamAssets folder.

Open ucabcnd opened this issue 3 years ago • 1 comments

Currently I have my project running in webGL.

I get the filepath to my glb files from my StreamingAssets folder in my WebGL project public static string currentModelFileName = Path.Combine(Application.streamingAssetsPath, "");

then I attempt to load in the glb files. Importer.LoadFromFileAsync(currentModelFileName,new ImportSettings(),onLoaded);

However i get the following error:

DirectoryNotFoundException: Could not find a part of the path ‘/file:/...../StreamingAssets’

Any suggestions on what to do or how to fix would be very much appreciated!

ucabcnd avatar Jun 25 '21 21:06 ucabcnd

Hello @ucabcnd ,

You should have a look at this :

  • https://docs.unity3d.com/Manual/StreamingAssets.html
  • https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Get.html

To read streaming Assets on platforms like Android and WebGL, where you cannot access streaming Asset files directly, use UnityWebRequest. For an example, see Application.streamingAssetsPath.

Regards.

barnabe-perspectives avatar Aug 05 '21 07:08 barnabe-perspectives