Unity Resource Generator
Automatically generate a type-safe helper class for Resources.Load with a single click. Organize your resource paths into categorized constants and convenience methods, eliminating string-based resource loading and reducing runtime errors. Supports prefabs, audio clips, scenes, and other asset types with customizable namespace and generation options.
com.autsoft.unityresourcegenerator 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/unityresourcegenerator.git?path=UnityResourceGenerator/Assets/AutSoft.UnityResourceGenerator README Markdown
Copy this to your project's README.md
## Installation
Add **Unity Resource Generator** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/unityresourcegenerator.git?path=UnityResourceGenerator%2FAssets%2FAutSoft.UnityResourceGenerator
```
[](https://www.pkglnk.dev/pkg/unityresourcegenerator)README
Unity Resource Generator

Automatically generate a helper class for Resources.Load in Unity with the press of a button.

With this folder structure:
Assets/
├─ Resources/
│ ├─ Coin.prefab
│ ├─ Coin.mp3
├─ Scenes/
│ ├─ CoinRain.unity
The following helper class is generated:
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Sample
{
// ReSharper disable PartialTypeWithSinglePart
public static partial class ResourcePaths
{
public static partial class Scenes
{
public const string CoinRain = "Scenes/CoinRain";
public static void LoadCoinRain(LoadSceneMode mode = LoadSceneMode.Single) =>
SceneManager.LoadScene(CoinRain, mode);
public static AsyncOperation LoadAsyncCoinRain(LoadSceneMode mode = LoadSceneMode.Single) =>
SceneManager.LoadSceneAsync(CoinRain, mode);
}
public static partial class Prefabs
{
public const string Coin = "Coin";
public static GameObject LoadCube() => Resources.Load<GameObject>(Coin);
}
public static partial class AudioClips
{
public const string Coin = "Coin";
public static AudioClip LoadCoin() => Resources.Load<AudioClip>(Coin);
}
}
}
Installation
Use OpenUPM to install the package.
openupm add com.autsoft.unityresourcegenerator
Documentation
For the complete documentation, visit the website.
No comments yet. Be the first!