glTF 2.0 importer and exporter for Unity 5.6 or later
Improved material importer(UniGLTF-1.21) !
Import gltf from (DamagedHelmet)[https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet]. Below is converted to unity standard shader.
- Mesh.IndexFormat(from 2017.3) is required
example. SciFiHelmet(70074vertices)
- drop gltf folder or glb file into Assets folder
or
- editor mode
- menu [UniGLTF] - [Import]
- open gltf file(gltf, glb, zip) from out of Asset Folder
string path; // gltf, glb or zip(include gltf)
var context = gltfImporter.Load(path);
context.ShowMeshes();
GameObject root = context.Root;
- select target root GameObject in scene(GameObect must be empty root, because target become gltf's
/scene
. A scene includes nodes. - menu [UniGLTF] - [Export]
- support only glb format
GameObject go; // export target
string path; // glb write path
var gltf = gltfExporter.Export(go);
var bytes = gltf.ToGlbBytes();
File.WriteAllBytes(path, bytes);
- support only glb format