[unity] Fixed SkeletonGraphic Update When Invisible not working. Now it uses onCullStateChanged, which can be used with RectMask2D. Closes #1910.

This commit is contained in:
Harald Csaszar 2021-06-23 20:30:33 +02:00
parent 878c862af4
commit b3f76c4e54

View File

@ -202,7 +202,8 @@ namespace Spine.Unity {
protected override void Awake () {
base.Awake ();
updateMode = updateWhenInvisible;
this.onCullStateChanged.AddListener(OnCullStateChanged);
SyncRawImagesWithCanvasRenderers();
if (!this.IsValid) {
#if UNITY_EDITOR
@ -313,6 +314,13 @@ namespace Spine.Unity {
UpdateMesh();
}
protected void OnCullStateChanged (bool culled) {
if (culled)
OnBecameInvisible();
else
OnBecameVisible();
}
public void OnBecameVisible () {
updateMode = UpdateMode.FullUpdate;
}