瀏覽代碼

[unity] Fixed `Update when invisible`: mesh and mesh bounds were not always initialized when starting off-screen. Closes #1911.

Harald Csaszar 4 年之前
父節點
當前提交
11077589c3
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs

+ 6 - 1
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);