Эх сурвалжийг харах

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

Harald Csaszar 4 жил өмнө
parent
commit
11077589c3

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