Provides a unifying way to download and load external media assets (audio, image, video) to your Unity project. Unity may have an official package Addressables that does the similar thing. But I personally haven't tested it yet.
- Install dependency: https://github.com/seeyam-q/YouNeiTiToolbox.git#upm-youneiti-toolbox
- In the Unity editor,
Window->Package Manager
add package from git url: https://github.com/seeyam-q/YouNeiTiToolbox.git#upm-external-asset-loader
- Create an empty
GameObject
in the main scene and addExternalAssetLoader
component to the object. - Change
LocalAssetsFolderPath
to suit the need of the project. - On startup, all media files under
LocalAssetsFolderPath
will be loaded andAssetController.LocalAssetLoadingFinished
will be called when it's done. Audio files will be loaded asAudioClip
and image files will be loaded asTexture2D
. Video files will only be loaded as their absolute file path. The filename without the extension will be used as theAssetKey
to retrieve the asset. - You can access the loaded asset via the functions below:
ExternalAssetLoader.Instance.AllAvailableAssets[assetkey]
ExternalAssetLoader.Instance.PreLoadedImagesAssets[assetKey]
ExternalAssetLoader.Instance.PreLoadedAudioClips[assetKey]
ExternalAssetLoader.Instance.DownloadedVideoPaths[assetKey]