mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fixed editor OutOfBoundsException at SkeletonGraphic when switching to skin with more vertices while preventing another exception (occurred after fix bd7f7eb1). Closes #2089.
This commit is contained in:
parent
e7ee3f417d
commit
3d2484697a
@ -114,6 +114,11 @@ namespace Spine.Unity {
|
|||||||
} else {
|
} else {
|
||||||
if (freeze) return;
|
if (freeze) return;
|
||||||
|
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
Initialize(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(initialSkinName)) {
|
if (!string.IsNullOrEmpty(initialSkinName)) {
|
||||||
var skin = skeleton.Data.FindSkin(initialSkinName);
|
var skin = skeleton.Data.FindSkin(initialSkinName);
|
||||||
if (skin != null) {
|
if (skin != null) {
|
||||||
@ -124,19 +129,6 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only provide visual feedback to inspector changes in Unity Editor Edit mode.
|
|
||||||
if (!Application.isPlaying) {
|
|
||||||
skeleton.ScaleX = this.initialFlipX ? -1 : 1;
|
|
||||||
skeleton.ScaleY = this.initialFlipY ? -1 : 1;
|
|
||||||
|
|
||||||
state.ClearTrack(0);
|
|
||||||
skeleton.SetToSetupPose();
|
|
||||||
if (!string.IsNullOrEmpty(startingAnimation)) {
|
|
||||||
state.SetAnimation(0, startingAnimation, startingLoop);
|
|
||||||
Update(0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Under some circumstances (e.g. sometimes on the first import) OnValidate is called
|
// Under some circumstances (e.g. sometimes on the first import) OnValidate is called
|
||||||
@ -727,12 +719,6 @@ namespace Spine.Unity {
|
|||||||
meshGenerator.Begin();
|
meshGenerator.Begin();
|
||||||
|
|
||||||
bool useAddSubmesh = currentInstructions.hasActiveClipping && currentInstructions.submeshInstructions.Count > 0;
|
bool useAddSubmesh = currentInstructions.hasActiveClipping && currentInstructions.submeshInstructions.Count > 0;
|
||||||
#if UNITY_EDITOR
|
|
||||||
// Editor triggers Graphic.Rebuild without prior LateUpdate call, which
|
|
||||||
// can lead to filling unprepared vertex buffer and out-of-bounds write access.
|
|
||||||
if (!Application.isPlaying)
|
|
||||||
useAddSubmesh = true;
|
|
||||||
#endif
|
|
||||||
if (useAddSubmesh) {
|
if (useAddSubmesh) {
|
||||||
meshGenerator.AddSubmesh(currentInstructions.submeshInstructions.Items[0], updateTriangles);
|
meshGenerator.AddSubmesh(currentInstructions.submeshInstructions.Items[0], updateTriangles);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user