From f0f52da3ad19712a8bdd070e954700a4cb9e3451 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 20 May 2021 19:26:21 +0200 Subject: [PATCH 1/2] [unity] Fixed too high Mesh vertex count when multiple submeshes are used (in combination with clipping). Supported on Unity 2019.3+. Closes #1894. --- .../Runtime/spine-unity/Mesh Generation/MeshGenerator.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs index 27a2f0eaa..1b1df877e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs @@ -27,6 +27,10 @@ * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if UNITY_2019_3_OR_NEWER +#define MESH_SET_TRIANGLES_PROVIDES_LENGTH_PARAM +#endif + // Not for optimization. Do not disable. #define SPINE_TRIANGLECHECK // Avoid calling SetTriangles at the cost of checking for mesh differences (vertex counts, memberwise attachment list compare) every frame. //#define SPINE_DEBUG @@ -1117,7 +1121,11 @@ namespace Spine.Unity { mesh.subMeshCount = submeshCount; for (int i = 0; i < submeshCount; i++) +#if MESH_SET_TRIANGLES_PROVIDES_LENGTH_PARAM + mesh.SetTriangles(submeshesItems[i].Items, 0, submeshesItems[i].Count, i, false); +#else mesh.SetTriangles(submeshesItems[i].Items, i, false); +#endif } #endregion From fab2b6e4ce46df39495bba797fdb94f7c25130d7 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 25 May 2021 17:22:08 +0200 Subject: [PATCH 2/2] [unity] Hopefully fixed Spine Preferences `textureSettingsReference` setting changing between MacOS and Win. See #1895. --- .../Editor/spine-unity/Editor/Windows/SpinePreferences.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs index a8469d22d..c838b9ffe 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs @@ -236,7 +236,9 @@ namespace Spine.Unity.Editor { if (string.IsNullOrEmpty(textureSettingsRef.stringValue)) { var pmaTextureSettingsReferenceGUIDS = AssetDatabase.FindAssets("PMATexturePreset"); if (pmaTextureSettingsReferenceGUIDS.Length > 0) { - textureSettingsRef.stringValue = AssetDatabase.GUIDToAssetPath(pmaTextureSettingsReferenceGUIDS[0]); + var assetPath = AssetDatabase.GUIDToAssetPath(pmaTextureSettingsReferenceGUIDS[0]); + if (!string.IsNullOrEmpty(assetPath)) + textureSettingsRef.stringValue = assetPath; } }