[unity] PointFollower and BoundingBoxFollower now correctly unsubscribe from events on deletion / disable. Closes #1729.

This commit is contained in:
Harald Csaszar 2020-07-29 11:53:32 +02:00
parent 3be202711c
commit 0e2ced5042
2 changed files with 8 additions and 0 deletions

View File

@ -177,6 +177,9 @@ namespace Spine.Unity {
void OnDisable () {
if (clearStateOnDisable)
ClearState();
if (skeletonRenderer != null)
skeletonRenderer.OnRebuild -= HandleRebuild;
}
public void ClearState () {

View File

@ -100,6 +100,11 @@ namespace Spine.Unity {
}
}
void OnDestroy () {
if (skeletonRenderer != null)
skeletonRenderer.OnRebuild -= HandleRebuildRenderer;
}
public void LateUpdate () {
#if UNITY_EDITOR
if (!Application.isPlaying) skeletonTransformIsParent = Transform.ReferenceEquals(skeletonTransform, transform.parent);