Skip to content



How to create GLB/GLTF file from Unity

You can create a 3D model in Unity. This can be done by adding meshes and materials to the GameObject. How exactly to do this will not be discussed in this blog post. If you have a 3D model within Unity it is possible to export it to a GLB/GLTF file.

This requires a package that makes it possible to import and export the 3D model both via the editor and via runtime.

The package that makes it possible to do this is called: glTFast (

The package can easily be added within Unity. This can be done by going to Windows > package manager in the Unity project.

Unity windows package manager

When the package manager is displayed you can press the (+) button. Here you can then search by name. The name to search for is:

Add package Unity package manager

Once the package is installed, you can right-click a game object and then export it as a GLB/GLTF file. You can also import a GLB/GLTF file into Unity with this package. How to do this is explained in the documentation (

Runtime export GLB file

When you want to export a GLB file during runtime you need to add a reference from glTFast.Export in your assembly file. You can create te assembly file to right click on the folder where you want the reference file and choose then for the option “Assembly Definition File”.

Add reference assembly

This will create a “ExportDefinition.asmdef” file. In this file you can add the reference, but you can also go back to Unity and select the reference file. In the inspector of Unity the reference file will being showed. Here you can add the reference through a GUI. So under the “Assembly Definition References” you add the reference to:

  • glTFast

  • glTFast.Export

So you will get something likes this:

Add assembly definition in Unity

Now you can export a game object during runtime. An example of these code is in the documentation (