using UnityEngine;
[ExecuteAlways]
class BoxColliderScaler : MonoBehaviour
{
#if UNITY_EDITOR
void Update()
{
if (Application.isPlaying) return;
SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
if (spriteRenderer == null) return;
if (spriteRenderer.drawMode == SpriteDrawMode.Simple) return;
BoxCollider2D boxCollider = GetComponent<BoxCollider2D>();
if (boxCollider == null) return;
boxCollider.size = spriteRenderer.size;
}
#endif
}