The AXitAssetLoader is a flexible asset management system designed to work with both Unity’s Addressables and Resources systems. It supports asynchronous asset loading with coroutine or UniTask and can be easily integrated with dependency injection frameworks like VContainer or Zenject.
- Open Unity and go to Package Manager via Windows > Package Manager.
- Click on the Plus (+) icon > Add Package from git URL.
- Paste the following link in the URL field:
https://github.com/ngocphat03/Axit.AssetLoader.git - Click Add to install the package into your project.
-
ADDRESSABLES_ASSET_LOADEDEnables support for Unity’s Addressables system.
-
UNITASKEnables the use of UniTask for asynchronous programming.
Note: If you don’t add the ADDRESSABLES_ASSET_LOADED symbol, the system will use Resources instead of Addressables for loading assets.
Switching Between Addressables and Resources
GameObject asyncLoadResult;
#if ADDRESSABLES_ASSET_LOADED
asyncLoadResult = await DependencyLocator.AssetLoader.LoadAssetAsync<GameObject>(key: "MyAsset").ToUniTask();
#else
this.StartCoroutine(DependencyLocator.AssetLoader.LoadAssetAsync<GameObject>(key: "MyAsset")
.ToCoroutine(result =>
{
asyncLoadResult = result;
}));
#endifThe AssetLoaderMonoInstall can be configured to work standalone or with dependency injection (DI) frameworks like VContainer or Zenject. Follow the steps below for different setups.
- Create a GameObject:
- In the Unity Editor, go to the Hierarchy window.
- Right-click and select Create Empty to create a new GameObject.
- Attach the Script:
- Drag the
AssetLoaderMonoInstall.csscript from the Project window and drop it onto the GameObject.
- Drag the
- Configure Persistence (Optional):
- Select the GameObject in the Hierarchy.
- In the Inspector, find the
isPersistentAcrossScenesoption:- Enabled (default): The GameObject will persist across scene changes.
- Disabled: Uncheck the box if you don't need this behavior.
🚧 Feature is coming soon.
Support for VContainer is under development. Stay tuned for updates.
🚧Feature is coming soon.
Integration with Zenject will be available in an upcoming release.
- Standalone Mode: Use
AssetLoaderMonoInstallas a standard MonoBehaviour. - VContainer or Zenject: Replace with appropriate DI installers to enable dependency injection.
this.StartCoroutine(DependencyLocator.AssetLoader.LoadAssetAsync<GameObject>(key: "TestAsset")
.ToCoroutine(result =>
{
GameObject asyncLoadResult = result;
}));GameObject asyncLoadResult = await DependencyLocator.AssetLoader.LoadAssetAsync<GameObject>(key: "TestAsset").ToUniTask();- Use
AssetLoaderMonoInstallfor standalone setups or integrate with DI frameworks like VContainer or Zenject for advanced workflows. - Leverage conditional symbols
ADDRESSABLES_ASSET_LOADEDandUNITASKto adapt the loader to your project’s needs. - Supports both coroutine-based and UniTask-based asynchronous workflows for asset loading.