평점 만점의 리뷰가 11,000개 이상
8만 5천명 이상의 리뷰
10만명 이상의 포럼 멤버가 선호하는 에셋
유니티에서 모더레이팅하는 모든 에셋
Unity Version | Built-in | URP | HDRP |
---|---|---|---|
6000.0.32f1 | Compatible | Compatible | Compatible |
2023.2.20f1 | Compatible | Compatible | Compatible |
Overview
This package is an add-on to Addressables that gives you the ability to use your assets in a very convenient way with compile-time checking.
How to generate source codes
You can use an `AddressablesSourceGenerator` asset.
```
var generator = AssetDatabase.LoadAssetAtPath<AddressableSourceGenerator>( AssetDatabase.GUIDToAssetPath( AssetDatabase.FindAssets( "t:AddressableSourceGenerator" ).Single() ) );
generator.Generate();
```
Or you can use an `ResourcesSourceGenerator` and `LabelsSourceGenerator` classes.
```
var settings = AddressableAssetSettingsDefaultObject.Settings;
new ResourcesSourceGenerator().Generate( "Assets/UnityEngine.AddressableAssets/R.cs", "UnityEngine.AddressableAssets", "R", settings );
new LabelsSourceGenerator().Generate( "Assets/UnityEngine.AddressableAssets/L.cs", "UnityEngine.AddressableAssets", "L", settings );
```
Example of generated source codes
It generates source codes that looks something like this:
```
namespace UnityEngine.AddressableAssets {
public static class @R {
public static class @MyProject {
public static class @Scenes {
public const string @MainScene = "MyProject/Scenes/MainScene.unity";
public const string @GameScene = "MyProject/Scenes/GameScene.unity";
}
}
}
public static class @L {
public const string @default = "default";
public const string @Scene = "scene";
}
}
```
How to use generated source codes
You can use your assets very easily:
```
var address = R.MyProject.Scenes.MainScene;
var label = L.Scene;
```