diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs index eecdc8a86..d3bc1696c 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using System.Text.RegularExpressions; using UniJSON; using UnityEngine; diff --git a/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs b/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs index 9c58fd5d0..547c32d56 100644 --- a/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs +++ b/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs @@ -88,5 +88,42 @@ namespace UniGLTF Assert.AreEqual(new string[] { "KHR_materials_unlit" }, parsed["extensionUsed"].ArrayItems().Select(x => x.GetString()).ToArray()); } + + [Test] + public void Empty_extensionUsed() + { + var dst = GltfJsonUtil.FindUsedExtensionsAndUpdateJson(@"{ + ""asset"": { + ""generator"": ""COLLADA2GLTF"", + ""version"": ""2.0"" + }, + ""scene"": 0, + ""scenes"": [ + { + ""nodes"": [ + 0 + ] } -} \ No newline at end of file + ], + ""extensionUsed"": [""dummy""], + ""materials"": [ + { + ""pbrMetallicRoughness"": { + ""baseColorFactor"": [ + 0.800000011920929, + 0.0, + 0.0, + 1.0 + ], + ""metallicFactor"": 0.0 + }, + ""name"": ""Red"" + } + ] +}"); + + var parsed = dst.ParseAsJson(); + Assert.False(parsed.ContainsKey("extensionUsed")); + } + } +}