wuxianshengcong/Library/PackageCache/com.unity.2d.animation@9.1.2/Runtime/SpriteSkinUpdateHelper.cs
2024-12-30 12:56:27 +08:00

34 lines
893 B
C#

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