Siccity / GLTFUtility

Simple GLTF importer for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportGLBAsync doesn't work in unity webGL program

wangdahao opened this issue · comments

In the Unity Web side program, I called UnityWebrequest in the coroutine function to get a GLB file from server, and then called ImportGLBAsync to load the GLB, it did not take effect, GLB did not load successfully. But calling LoadFromBytes (sync mode),the GLB load succeeds.
In both cases, however, the results were successful in the Unity client.
`if (unityWebRequest.isDone)
{
Debug.Log("resource load down success: ");
byte[] results = unityWebRequest.downloadHandler.data;
string str_content = System.Text.Encoding.Default.GetString(results);
Debug.Log("resource content: " + str_content);

            AnimationClip[] animClips;
            var importSetting = new ImportSettings();
            importSetting.useLegacyClips = true;

            //load failed
            Importer.ImportGLBAsync(results, importSetting, OnFinishAsync);

             //load success
            //GameObject rootObj = Importer.LoadFromBytes(results, importSetting, out animClips);
        }`