# :jigsaw: Pref Wrappers

**Pref Wrappers** are auto-generated static classes that make it easy to access your PlayerPrefs and EditorPrefs from anywhere in your code — with full type safety, no manual instantiation, and clear autocomplete support.

They act as a clean, centralized interface for your pref types, if you like to use [Static access](/prefs/working-with-prefs.md#label-static-access). In many ways, they’re a smarter, extensible replacement for Unity’s built-in `PlayerPrefs` and `EditorPrefs` classes.

Pref Wrappers include all built-in pref types, as well as any custom pref types you’ve defined. Just regenerate the wrappers anytime you add or modify custom types.

---

## :alarm_clock: When to Use Them
Use Pref Wrappers when:
- You want **quick and easy access** to your prefs
- You prefer **a static, centralized API** over managing pref instances
- You want to avoid creating new pref instances repeatedly in your code

Read more about the differences between Static and Instance-based access:  
[!ref](/prefs/working-with-prefs)

---

## :arrows_counterclockwise: How to Generate
You can generate or regenerate wrappers directly from the **EazyPrefs Editor**:
1. Open the **EazyPrefs Window**
2. Navigate to the **Settings** tab and find the **Pref Wrappers** section
3. Click the `Regenerate` button

![](/img/wrappersGenerate.png)

This process will:
- Detect all built-in and custom pref types
- Generate strongly-typed getter and setter methods for all pref types
- Create or update the `EazyPlayerPrefs` and `EazyEditorPrefs` classes

!!!
Be sure to regenerate wrappers whenever you add new pref types or modify existing ones to ensure everything stays in sync.
!!!

---

## :white_check_mark: Best Practices
- Regenerate wrappers whenever you **add**, **rename**, or **change the type** of a pref
- Treat wrappers as **auto-generated files** — don’t manually edit them
- If you’re using version control, consider committing the generated wrapper files so they’re shared across your team
- You can continue to use instance-based or custom-pref access alongside wrappers — they don’t conflict

---

## :file_folder: Where Are They Generated?
By default, wrappers are saved to:

```
Assets/Resources/EazyPrefs
```

If you move the files elsewhere, EazyPrefs will remember the location and regenerate them into the **same folder** next time.

---
