From d652f560ce526e0eb753edc2846827ef089c4498 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 28 Aug 2023 20:19:17 +0200 Subject: [PATCH] [unity] Fixed compile error on Unity 2019.1 and older of last commits related to pull request #2351, commit 01273670. --- .../Runtime/spine-unity/Components/EditorSkeletonPlayer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/EditorSkeletonPlayer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/EditorSkeletonPlayer.cs index a92a6cadb..d41f2e09b 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/EditorSkeletonPlayer.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/EditorSkeletonPlayer.cs @@ -72,9 +72,11 @@ namespace Spine.Unity { if (Application.isPlaying) return; if (skeletonWrapper == null) { - if (TryGetComponent(out SkeletonAnimation skeletonAnimation)) + SkeletonAnimation skeletonAnimation; + SkeletonGraphic skeletonGraphic; + if (skeletonAnimation = this.GetComponent()) skeletonWrapper = new SkeletonAnimationWrapper(skeletonAnimation); - else if (TryGetComponent(out SkeletonGraphic skeletonGraphic)) + else if (skeletonGraphic = this.GetComponent()) skeletonWrapper = new SkeletonGraphicWrapper(skeletonGraphic); } @@ -88,6 +90,7 @@ namespace Spine.Unity { private void Update () { if (enabled == false || Application.isPlaying) return; + if (skeletonWrapper == null) return; if (skeletonWrapper.State == null || skeletonWrapper.State.Tracks.Count == 0) return; TrackEntry currentEntry = skeletonWrapper.State.Tracks.Items[0];