[unity] SkeletonGraphic: re-joined Rebuild and MeshUpdate to fix IndexOutOfRangeException. Closes #2487.

This commit is contained in:
Harald Csaszar 2024-03-19 16:13:30 +01:00
parent bd781912da
commit c36f847319
2 changed files with 3 additions and 9 deletions

View File

@ -121,7 +121,6 @@ namespace Spine.Unity {
public bool updateSeparatorPartScale = false;
private bool wasUpdatedAfterInit = true;
private bool requiresInstructionUpate = true;
private Texture baseTexture = null;
#if UNITY_EDITOR
@ -315,7 +314,7 @@ namespace Spine.Unity {
if (!this.IsValid) return;
if (canvasRenderer.cull) return;
if (update == CanvasUpdate.PreRender) {
if (requiresInstructionUpate) PrepareInstructionsAndRenderers(isInRebuild: true);
PrepareInstructionsAndRenderers(isInRebuild: true);
UpdateMeshToInstructions();
}
if (allowMultipleCanvasRenderers) canvasRenderer.Clear();
@ -420,9 +419,7 @@ namespace Spine.Unity {
if (updateTiming == UpdateTiming.InLateUpdate)
Update(unscaledTime ? Time.unscaledDeltaTime : Time.deltaTime);
PrepareInstructionsAndRenderers();
SetVerticesDirty(); // triggers Rebuild and avoids potential double-update in a single frame
UpdateMesh();
}
protected void OnCullStateChanged (bool culled) {
@ -468,11 +465,9 @@ namespace Spine.Unity {
public Skeleton Skeleton {
get {
Initialize(false);
requiresInstructionUpate = true;
return skeleton;
}
set {
requiresInstructionUpate = true;
skeleton = value;
}
}
@ -722,7 +717,6 @@ namespace Spine.Unity {
}
public void PrepareInstructionsAndRenderers (bool isInRebuild = false) {
requiresInstructionUpate = false;
if (!this.allowMultipleCanvasRenderers) {
MeshGenerator.GenerateSingleSubmeshInstruction(currentInstructions, skeleton, null);
if (canvasRenderers.Count > 0)

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.",
"version": "4.1.39",
"version": "4.1.40",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",