From 8ea166b3315638d7fa77648c4f118be290065511 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 29 Sep 2021 21:10:58 +0200 Subject: [PATCH] [unity] Fixed json vs binary file detection. --- .../spine-unity/Asset Types/SkeletonDataCompatibility.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs index 02910f609..6404a1357 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs @@ -173,11 +173,16 @@ namespace Spine.Unity { int i = 0; if (content.Length >= 3 && content[0] == 0xEF && content[1] == 0xBB && content[2] == 0xBF) // skip potential BOM i = 3; + bool openingBraceFound = false; for (; i < numCharsToCheck; ++i) { char c = (char)content[i]; if (char.IsWhiteSpace(c)) continue; - return c == '{'; + if (!openingBraceFound) { + if (c == '{') openingBraceFound = true; + else return false; + } else + return c == '"'; } return true; }