gltfImporter.cs
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using UnityEngine;
namespace UniGLTF
{
public static class gltfImporter
{
[Obsolete("Use ImporterContext.Load(path)")]
public static ImporterContext Load(string path)
{
var context = new ImporterContext();
context.Load(path);
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
return context;
}
[Obsolete("Use ImporterContext.Parse(path, bytes)")]
public static ImporterContext Parse(string path, Byte[] bytes)
{
var context = new ImporterContext();
context.Load(path);
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
return context;
}
[Obsolete("use ImporterContext.Load()")]
public static void Load(ImporterContext context)
{
context.Load();
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
}
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(() =>
{
if (show)
{
context.ShowMeshes();
}
onLoaded(context.Root);
},
onError);
}
}
}