O2 Unity Auto Asset Mapper is a Unity tool that automates the process of mapping assets (like AudioClips, Sprites, Prefabs, etc.) to enum keys using ScriptableObject and Addressables. It generates all necessary code and assets so you can reference and load them in a clean, type-safe, and scalable way.
🔧 Access assets via enums, cache at runtime, load dynamically in editor — all generated for you.
- ✅ Auto-generated enum keys from selected assets
- ✅ ScriptableObject-based asset mapping
- ✅ Enum-to-asset implicit conversion support
- ✅ Addressables label integration (load by label)
- ✅ Editor window UI to create mappers easily
- ✅ Runtime caching, Editor dynamic loading
- ✅ Prevents common serialization issues via auto-generated boilerplate
- ✅ Easy to extend and integrate into existing Unity projects
- Select assets in the Project window.
- Open the Map Creator from the context menu or custom editor.
- Define the enum keys (automatically filled based on asset names).
- Generate the mapper, asset wrapper, and key enum via a single button.
- Use the generated struct (e.g.
MyAudioAsset) directly in your code.
-
Right-click in the Project Explorer window.
-
Navigate to:
Assets > O2 Mapper > Create Mapper For a Type -
A window will open displaying all Unity asset types.
Use the search box to filter and select your desired type. -
After selection, proceed to the mapper creation window where you assign keys and configure the mapper.
-
Click Generate to create the mapper script.
Once compilation finishes, a ScriptableObject asset is generated and populated automatically.
- Select one or multiple assets (e.g., Material, GameObject) in Project Explorer.
- Right-click and choose:
Assets > O2 Mapper > Create with Selected Items - The mapper creation window opens immediately for the detected asset type, with automatic keys assigned.
This workflow makes it quick and easy to generate type-safe mappers for any asset type in your project.
[SerializeField] VfxSoundAsset vfxSoundAsset;
public void PlayAudio() {
// Play audio directly from the assigned asset
audioSource.PlayOneShot(vfxSoundAsset);
// Or get clip by index
AudioClip clip = VfxSoundMapper.GetWithIndex(4);
// Or get clip by enum key
AudioClip clip2 = VfxSoundMapper.GetWithKey(VfxSoundAssetKey.CarHit- Addressables package:
com.unity.addressables


