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

This commit is contained in:
Harald Csaszar 2021-07-05 21:21:24 +02:00
parent 2bc9dfebf4
commit 11077589c3

View File

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