Addressables Source Generator
Denis535
$0.0
(no ratings)
Date |
Price |
---|---|
Date |
Price($) |
03/08(2024) |
0.0 |
11/25(2024) |
0.0 |
Jump AssetStore
This is an add-on to Addressables that gives you the ability to use your assets in a very convenient way with compile-time checking.OverviewThis 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 codesYou can use an `AddressablesSourceGenerator` asset.```var generator = AssetDatabase.LoadAssetAtPath( 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 codesIt 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 codesYou can use your assets very easily:```var address = R.MyProject.Scenes.MainScene;var label = L.Scene;```Easy use of all addresses and labels.Compiler-time checking.