Importer Sample - ousttrue/UniGLTF GitHub Wiki

Runtime

//
// UniGLTF-1.22
//
var path = UnityEditor.EditorUtility.OpenFilePanel("open gltf", "", "gltf,glb,zip");
if (string.IsNullOrEmpty(path))
{
    return;
}
Debug.LogFormat("open: {0}", path);

var context = new ImporterContext();
context.Parse(path, bytes);
context.Load();
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
context.Root.name = Path.GetFileNameWithoutExtension(path);

Asynchronous

//
// UniGLTF-1.22
//
public static void LoadVrmAsync(string path, Byte[] bytes, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
{
    var context = new ImporterContext();
    context.Parse(path, bytes);
    context.LoadAsync(onLoaded, onError, show);
}
⚠️ **GitHub.com Fallback** ⚠️