Skip to content

Commit d16dbbc

Browse files
author
András Kurai
committed
update readme, add badges
1 parent 078951d commit d16dbbc

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

Documentation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Unity Resource Generator
1+
# Unity Resource Generator [![openupm](https://img.shields.io/npm/v/com.autsoft.unityresourcegenerator?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.autsoft.unityresourcegenerator/) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/release/AutSoft/UnityResourceGenerator?style=flat)](https://github.com/AutSoft/UnityResourceGenerator/releases/latest) [![Publish](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish.yml/badge.svg)](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish.yml) [![Publish To GitHub Pages](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish-to-gh-pages.yml/badge.svg)](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish-to-gh-pages.yml)
22

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

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,66 @@
1-
# UnityResourceGenerator
1+
# Unity Resource Generator [![openupm](https://img.shields.io/npm/v/com.autsoft.unityresourcegenerator?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.autsoft.unityresourcegenerator/) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/release/AutSoft/UnityResourceGenerator?style=flat)](https://github.com/AutSoft/UnityResourceGenerator/releases/latest) [![Publish](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish.yml/badge.svg)](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish.yml) [![Publish To GitHub Pages](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish-to-gh-pages.yml/badge.svg)](https://github.com/AutSoft/UnityResourceGenerator/actions/workflows/publish-to-gh-pages.yml)
2+
3+
Automatically generate a helper class for `Resources.Load` in Unity with the press of a button.
4+
5+
![Generate Button](~/images/intro/GenerateButton.png)
6+
7+
With this folder structure:
8+
9+
```
10+
Assets/
11+
├─ Resources/
12+
│ ├─ Coin.prefab
13+
│ ├─ Coin.mp3
14+
├─ Scenes/
15+
│ ├─ CoinRain.unity
16+
```
17+
18+
The following helper class is generated:
19+
20+
```csharp
21+
using UnityEngine;
22+
using UnityEngine.SceneManagement;
23+
24+
namespace Sample
25+
{
26+
// ReSharper disable PartialTypeWithSinglePart
27+
public static partial class ResourcePaths
28+
{
29+
30+
public static partial class Scenes
31+
{
32+
public const string CoinRain = "Scenes/CoinRain";
33+
34+
public static void LoadCoinRain(LoadSceneMode mode = LoadSceneMode.Single) =>
35+
SceneManager.LoadScene(CoinRain, mode);
36+
37+
public static AsyncOperation LoadAsyncCoinRain(LoadSceneMode mode = LoadSceneMode.Single) =>
38+
SceneManager.LoadSceneAsync(CoinRain, mode);
39+
}
40+
41+
public static partial class Prefabs
42+
{
43+
public const string Coin = "Coin";
44+
public static GameObject LoadCube() => Resources.Load<GameObject>(Coin);
45+
}
46+
47+
public static partial class AudioClips
48+
{
49+
public const string Coin = "Coin";
50+
public static AudioClip LoadCoin() => Resources.Load<AudioClip>(Coin);
51+
}
52+
}
53+
}
54+
```
55+
56+
## Installation
57+
58+
Either use the `.unitypackage` provided in the releases or use OpenUPM
59+
60+
```
61+
openupm add com.autsoft.unityresourcegenerator
62+
```
63+
64+
## Documentation
65+
66+
For the complete documentation, visit the [website](https://autsoft.github.io/UnityResourceGenerator/).

0 commit comments

Comments
 (0)