From 149aad2fa04e054f7d2a65cbd50d350291253947 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 12 May 2023 17:41:32 +0200 Subject: [PATCH] [unity] Fixed RenderExistingMesh not updating when "Reload Scene" is disabled. Closes #2291. --- .../Scripts/Sample Components/RenderExistingMesh.cs | 10 ++++++++-- spine-unity/Assets/Spine Examples/package.json | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/RenderExistingMesh.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/RenderExistingMesh.cs index b900daf63..26bdcb153 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/RenderExistingMesh.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/RenderExistingMesh.cs @@ -101,10 +101,15 @@ namespace Spine.Unity.Examples { } #if UNITY_EDITOR + // handle disabled scene reload + private void OnEnable () { + if (Application.isPlaying) + Awake(); + } + private void Update () { - if (!Application.isPlaying) { + if (!Application.isPlaying) InitializeDict(); - } } #endif @@ -142,6 +147,7 @@ namespace Spine.Unity.Examples { } void InitializeDict () { + replacementMaterialDict.Clear(); for (int i = 0; i < replacementMaterials.Length; ++i) { MaterialReplacement entry = replacementMaterials[i]; replacementMaterialDict[entry.originalMaterial] = entry.replacementMaterial; diff --git a/spine-unity/Assets/Spine Examples/package.json b/spine-unity/Assets/Spine Examples/package.json index a44616f26..b3d53db82 100644 --- a/spine-unity/Assets/Spine Examples/package.json +++ b/spine-unity/Assets/Spine Examples/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity-examples", "displayName": "spine-unity Runtime Examples", "description": "This plugin provides example scenes and scripts for the spine-unity runtime.", - "version": "4.1.0", + "version": "4.1.10", "unity": "2018.3", "author": { "name": "Esoteric Software", @@ -30,4 +30,4 @@ }, "homepage": "https://github.com/EsotericSoftware/spine-runtimes#readme", "type": "sample" -} \ No newline at end of file +}