File tree Expand file tree Collapse file tree 4 files changed +56
-4
lines changed
Expand file tree Collapse file tree 4 files changed +56
-4
lines changed Original file line number Diff line number Diff line change @@ -398,3 +398,4 @@ FodyWeavers.xsd
398398# End of https://www.toptal.com/developers/gitignore/api/visualstudio
399399
400400! .vscode /** /*
401+ .vscode /docfx-assistant
Original file line number Diff line number Diff line change 1- # This is the ** HOMEPAGE** .
2- Refer to [ Markdown] ( http://daringfireball.net/projects/markdown/ ) for how to write markdown files.
3- ## Quick Start Notes:
4- 1 . Add images to the * images* folder if the file is referencing an image.
1+ # Unity Resource Generator
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+ ```
Original file line number Diff line number Diff line change 1+ .\build.ps1 ServeDocs -- skip
You can’t perform that action at this time.
0 commit comments