UnityGLTF
Runtime glTF 2.0 Loader for Unity3D
Install / Use
/learn @KhronosGroup/UnityGLTFREADME
Unity3D library for importing and exporting glTF 2.0 assets.
| | Editor | Runtime | |--------|--------|---------| | Import | ✅ | ✅ | | Export | ✅ | ✅ |
UnityGLTF doesn't have any native dependencies (pure C#) and thus works on all platforms that Unity supports. This includes WebGL import and export.
The library is designed to be easy to extend with additional extensions to the glTF specification. Both import and export allow attaching custom plugins and callbacks and can be heavily modified to fit into specific pipelines. Many glTF extensions are supported.
Contents <!-- omit from toc -->
- Installation
- Unity Version and Render Pipeline Compatibility
- UnityGLTF and glTFast
- Supported Features and Extensions
- glTF Interactivity
- glTF Materials
- Exporting glTF Files
- Animation Export
- Blend Shape Export
- Importing glTF files
- Animation Import
- Extensibility
- Known Issues
- Contributing
Installation
You can install this package from the Needle Package Registry with a one-click installer:
- Download UnityGLTF Package Installer
- Drop the downloaded .unitypackage into Unity and follow the steps.
You can also install this package from git, compatible with UPM (Unity Package Manager).
- Open
Window > Package Manager - Click <kbd>+</kbd>
- Select <kbd>Add Package from git URL</kbd>
- Paste
https://github.com/KhronosGroup/UnityGLTF.git - Click <kbd>Add</kbd>.
Note: If you want to target a specific version, append
#release/<some-tag>or a specific commit to the URL above. Example:https://github.com/KhronosGroup/UnityGLTF.git#release/2.14.1.
Unity Version and Render Pipeline Compatibility
Please use Long-Term Support versions of Unity (2021.3+, 2022.3+, 6000.0+).
Recommended:
- Unity 2021.3+, Unity 2022.3+, Unity 6+
- Linear colorspace
- Universal Render Pipeline (URP) and Built-In Render Pipeline (BiRP)
HDRP:
- Currently limited functionality.
Legacy:
- When using Unity 2020.3, please use an older version of UnityGLTF, like 2.9.1-rc and before.
Note: Issues on non-LTS Unity versions (not on 2021.3, 2022.3, 6000.0...) will most likely not be addressed. Please use LTS (Long-Term Support) versions where possible.
UnityGLTF and glTFast
A separate glTF implementation for Unity, glTFast, is available from the Unity Registry.
glTFast being supported by Unity means, in a nutshell, that it sticks to standards pretty strictly and can't easily ship non-ratified extensions or experimental features that work for the majority, but not all, of users.
- UnityGLTF aims to be the more flexible framework, with extensive import/export plugin support and useful plugins out of the box.
- glTFast aims to be the more performant framework, with a focus on leveraging Unity-specific features such as Burst and Jobs.
- UnityGLTF has a versatile plugin/extension infrastructure. This allows for a lot of flexibility during import/export.
- UnityGLTF enables the use of and ships with non-ratified extensions such as
KHR_animation_pointer,KHR_audio, andKHR_materials_variants. - glTFast leverages Unity-specific features such as Burst and Jobs and thus can have better performance in some cases.
- glTFast has better HDRP support.
glTFast and UnityGLTF can coexist in the same project; you can for example use glTFast for import and UnityGLTF for export.
For imported assets, you can choose which importer to use with a dropdown.
glTFast import has precedence if both are in the same project. See also Default Importer Selection.
Supported Features and Extensions
The lists below are non-conclusive and in no particular order. Note that there are gaps where features could easily be supported for im- and export but currently aren't. PRs welcome!
Import and Export
- Animation and Animator with multiple clips
- Skinned Mesh Renderers
- Blend Shapes
- Sparse accessors for Blend Shapes
- Linear and Gamma colorspace support (Gamma won't be maintained anymore)
- Vertex Colors
- Cameras (perspective, orthographic)
- URP and Built-In Render Pipeline Learn More
- KHR_lights_punctual (point, spot, and directional lights)
- KHR_texture_transform (UV offset, scale, rotation)
- KHR_materials_unlit (unlit surfaces)
- KHR_materials_transmission (glass-like materials)
- KHR_materials_volume (refractive materials)
- KHR_materials_ior (for transmission and volume)
- KHR_materials_emissive_strength (emissive values greater than 1)
- KHR_materials_iridescence (thin-film interference, like oil on water)
- KHR_materials_clearcoat (secondary specular layer, like a coat of varnish)
- KHR_materials_sheen (fabric surfaces)
- KHR_materials_specular (partial support)
- KHR_materials_dispersion (refractive index dispersion)
- KHR_animation_pointer (arbitrary property animations)
- MSFT_lod (level of detail)
- KHR_node_visibility (GameObject active state)
KHR_node_hoverabilityKHR_node_selectability- [KHR_interactivity](https://github.com/KhronosGroup/glTF/blob/220ca407a2
