From 11077589c33b249798977a2224099addac99ce23 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 5 Jul 2021 21:21:24 +0200 Subject: [PATCH] [unity] Fixed `Update when invisible`: mesh and mesh bounds were not always initialized when starting off-screen. Closes #1911. --- .../Runtime/spine-unity/Components/SkeletonRenderer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs index a40a51052..f74827309 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs @@ -356,7 +356,12 @@ namespace Spine.Unity { for (int i = 0; i < separatorSlotNames.Length; i++) separatorSlots.Add(skeleton.FindSlot(separatorSlotNames[i])); - LateUpdate(); // Generate mesh for the first frame it exists. + // Generate mesh once, required to update mesh bounds for visibility + UpdateMode updateModeSaved = updateMode; + updateMode = UpdateMode.FullUpdate; + skeleton.UpdateWorldTransform(); + LateUpdate(); + updateMode = updateModeSaved; if (OnRebuild != null) OnRebuild(this);