Net-Game/Library/PackageCache/com.unity.2d.animation@494a3b4e73a9/Runtime/BatchedDeformation/DeformationManagerUpdater.cs
2025-03-28 08:33:16 -04:00

30 lines
853 B
C#

using Unity.Profiling;
namespace UnityEngine.U2D.Animation
{
[AddComponentMenu("")]
[DefaultExecutionOrder(UpdateOrder.spriteSkinUpdateOrder)]
[ExecuteInEditMode]
internal class DeformationManagerUpdater : MonoBehaviour
{
public System.Action<GameObject> onDestroyingComponent { get; set; }
ProfilerMarker m_ProfilerMarker = new ProfilerMarker("DeformationManager.LateUpdate");
void OnDestroy() => onDestroyingComponent?.Invoke(gameObject);
void LateUpdate()
{
if (DeformationManager.instance.helperGameObject != gameObject)
{
GameObject.DestroyImmediate(gameObject);
return;
}
m_ProfilerMarker.Begin();
DeformationManager.instance.Update();
m_ProfilerMarker.End();
}
}
}