Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Importer Sample

ousttrue edited this page Sep 22, 2018 · 1 revision

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);
}
Clone this wiki locally