Unity scene export file method in GLTF format

Recently, GLTF files need to be parsed in Unity, as well as scene information that can be exported to Unity. After inquiries, I finally decided to use the open source library UnitGLTF.

1. Preferred download code, git clone https://github.com/KhronosGroup/UnityGLTF.git

2. Open the UnityGLTF project

3. After opening the project, select a scene under Samples, there are too many error messages in Console.

Assets\UnityGLTF\Runtime\Scripts\Extensions\SchemaExtensions.cs(229,52): error CS0246: The type or namespace name 'GLTF' could not be found (are you missing a using directive or an assembly reference?)

Assets\UnityGLTF\Runtime\Scripts\GLTFSceneExporter.cs(54,11): error CS0246: The type or namespace name 'BufferId' could not be found (are you missing a using directive or an assembly reference?)

Assets\UnityGLTF\Runtime\Scripts\GLTFSceneExporter.cs(55,11): error CS0246: The type or namespace name 'GLTFBuffer' could not be found (are you missing a using directive or an assembly reference?)

Look at these error messages and see that the GLTF library is not imported.

4. Compile GLTFSerialization, and the final generated dll library is placed in the UnityGLTF\UnityGLTF\Assets\UnityGLTF\Runtime\Plugins directory.

 

5. Close, and re-play UnityGLTF again to see if it is normal? Hey, why is there still an error?

First, you need to delete uap10.0.10586 in the plugins directory, otherwise there will be duplicate libraries.

Assets\UnityGLTF\Tests\Runtime\GLTFAssetGeneratorTests.cs(3,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

There are still some errors, because Tests can't reference the GLTF library, we also delete Tests.

This cleans up all errors.

 

6. Export the GLTF file of the scene, you can see that a gltf json file and bin file can be exported.

GLTF related can be described with this picture.

references:

https://github.com/KhronosGroup/UnityGLTF

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0

https://github.khronos.org/glTF-Sample-Viewer-Release/

Guess you like

Origin blog.csdn.net/grace_yi/article/details/118751033