From 795fb920800bdd62e018dca41a00ae1a5c67fce1 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 7 Mar 2024 16:04:43 +0100 Subject: [PATCH] [unity] Fixed SkeletonBinary hash `{"` accidentally being detected as json. Closes #2474. --- .../spine-unity/Asset Types/SkeletonDataCompatibility.cs | 6 ++++++ spine-unity/Assets/Spine/package.json | 2 +- 2 files changed, 7 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 1898dae4a..1b9d68b62 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 @@ -163,6 +163,12 @@ namespace Spine.Unity { public static bool IsJsonFile (TextAsset file) { byte[] content = file.bytes; + + // check for binary skeleton version number string, starts after 8 byte hash + char majorVersionChar = compatibleBinaryVersions[0][0].ToString()[0]; + if (content.Length > 10 && content[9] == majorVersionChar && content[10] == '.') + return false; + const int maxCharsToCheck = 256; int numCharsToCheck = Math.Min(content.Length, maxCharsToCheck); int i = 0; diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 22e6a9449..45c7dccac 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.1.37", + "version": "4.1.38", "unity": "2018.3", "author": { "name": "Esoteric Software",