# Widget2D

**Package:** `com.amanotes.widget2d`  
**Version:** 2.1.5

Responsive UI system for Unity with automatic screen adaptation and component resizing.

---

## Features

- 🎮 Automatic component resizing
- 🎯 Screen2D for dynamic screen adaptation
- 🎨 WidgetTransform for responsive layouts
- 🚀 Support for SpriteRenderer, BoxCollider, RectTransform, TextMeshPro
- 🔧 ISizeListener interface for custom resize behavior

---

## Documentation

📄 **[View on Notion](https://www.notion.so/amagdk/Widget-2D-2f0446dc5211804fa815dc5f29d4fbf4)**

**Complete documentation:** [`Docs/Widget2D-API.md`](Docs/Widget2D-API.md)

---

## Installation

Add the package to your Unity project via `Packages/manifest.json`:

```json
{
  "dependencies": {
    "com.amanotes.widget2d": "2.1.5"
  },
  "scopedRegistries": [
    {
      "name": "npmjs",
      "url": "https://registry.npmjs.org/",
      "scopes": [
        "com.amanotes.widget2d"
      ]
    }
  ]
}
```

---

## Quick Start

```csharp
public class ResponsiveTile : MonoBehaviour
{
    void Start()
    {
        var widget = GetComponent<Widget2D>();
        widget.size = new Vector2(100, 100);
        
        // Widget automatically resizes attached components
    }
}
```

---

## API Reference

### Key Classes

**Widget2D**
- Purpose: Core component for responsive UI elements
- Key properties: `size`, `pivot`, `width`, `height`
- Key methods: `Refresh()`

**Screen2D**
- Purpose: Automatic screen adaptation
- Key methods: `Init()`

**WidgetTransform**
- Purpose: Advanced responsive layout system
- Key properties: `alignX`, `alignY`, `scaleX`, `scaleY`
- Key methods: `SetSource()`, `Refresh()`

**ISizeListener**
- Purpose: Interface for custom resize behavior
- Key methods: `OnResize(Vector2 size)`

**See:** [Complete API Reference](Docs/Widget2D-API.md)

---

## Dependencies

- Unity 2022.3+
- TextMeshPro (optional)

---

## Version History

See [CHANGELOG.md](CHANGELOG.md)
