GLTFUtility
GLTFUtility copied to clipboard
async sample code has a bug
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Siccity.GLTFUtility;
public class ModelLoader : MonoBehaviour
{
public string filename;
public void OnLoadTest()
{
ImportGLTFAsync(filename);
}
void ImportGLTFAsync(string filepath) {
Importer.ImportGLTFAsync(filepath, new ImportSettings(), OnFinishAsync);
}
void OnFinishAsync(GameObject result) {
Debug.Log("Finished importing " + result.name);
}
}
OnFinishAsync will redline in VSCode and Unity (line 13)
Is there a way to correct the third part of Importer.ImportGLTFAsync() to fix this?
fixed for now like this:
void ImportGLTFAsync(string filepath) {
Importer.ImportGLTFAsync(filepath, new ImportSettings(), OnFinishAsync);
}
void OnFinishAsync(GameObject result, GLTFAnimation.ImportResult[] air) {
Debug.Log("Finished importing " + result.name);
}
I think I'm having the same issue. The suggested fix is also not working. The async example code won't compile. It says:
cannot convert from 'method group' to 'Action<GameObject, AnimationClip[]>'
Did anything change in the source code?
Try adding , AnimationClip[] animations
to OnFinishAsync paramers
Hi, @Siccity . I tried your suggested fix, but still didn't work. Any idea of what may fix this? It works fine when i want to load a single .gltf file, but doesn't load the textures when they aren't embeded in the file.
, AnimationClip[] animations
This worked for me. Maybe change the code on the readme file?