Content Delivery Management and Unity CDN Plugin
Manage and speed up content delivery for your application by taking advantage of the Unity CDN plugin.
Initial setup
Git is required to take advantage of this service.
Import the Elements Unity CDN plugin into your project.
In Unity, open the editor window by going to Window -> Elements Cdn
.
Configuration
If this is the first time using this service in the project, click the Create Configuration
button. This will create a configuration file inside of the resources
folder in your project.
Navigate to the configuration file and enter your app's name into the APP_NAME field. If your project will be utilizing Unity Addressables, enter your addressable catalog name, including the .hash
extension.
Login
Enter your elements login credentials. Upon successful login, the window will change to show three tabs: Git, Build, and Deploy
Using the CDN Plugin
Git Tab
The git tab allows basic functionality for interacting with the git repository containing your app's static content.
If you have not yet initialized or cloned the repo, pressing the Initialize/Clone Repo
button will create a folder in the root of your project and clone the repo from the remote endpoint utilizing the username and password entered during setup.
Once the repo has been initialized two additional tabs will appear under the Git section.
Git Log:
This will show the log history of the git repo, including all changes pushed by all users.
There is a button on the bottom of the panel to Commit/Push
changes.
Git Status:
This will show the git status of your local repository.
Here you can stage or unstage all local repo changes. You can stage single files by copying the file name from the status window into the text field and pressing Stage Single File
.
Commit All Staged Changes
will create a commit with the commit message in the text field.
Push
will push all local commits to the remote repo for your app's static content.
Build Tab
The build tab exposes Unity's asset build pipeline within a central location to streamline asset bundle and addressable builds.
Asset Bundles:
You can select which platforms you would like to build asset bundles for with the platform checkboxes. Once selected, pressing Build Asset Bundles
will initiate builds for each selected platform.
The bundles will be built directly to the static content directory.
Addressables:
Addressables
must be configured for remote building.
Open the Addressables Profiles window: Window -> Asset Management -> Addressables -> Profile
.
Set the RemoteBuildPath to [CdnConfiguration.RemoteBuildPath]
Set the RemoteLoadPath to [CdnConfiguration.RemoteLoadPathPrefix]/appname{CdnConfiguration.RemoteLoadPathSuffix}
Continue to configure addressables as normal for you app.
Due to current Unity limitations, Addressables can only be built for the current target platform.
Build Addressables
and Update Addressables
will build the addressables directly to the static content directory.
If your addressables are marked as Remotely Updatable
and you wish to update a previous build, simply check the Update Previous Build
box and click Update Addressables
, which will bring up a prompt to select the .bin
file for your addressables.
Deploy Tab
The deploy tab allows you to see active deployments, create and update deployments using content available in specific commits from your static content repo, and delete deployments that are no longer needed.
View Existing Deployments
Clicking View Current Deployments
will get all current deployments for your app and display them in the text field above.
Create or Update
Identify which commit has the content you wish to be deployed and copy the commit hash. This can be done easily using the Git Log window.
Paste the commit into the text field with placeholder text "Revision Here."
Enter a string for the version you will be creating or updating in the field with placeholder text "Version Here."
If you are updating a version that has already been deployed, check the Update Previous Deployment
box and press Update Existing Version
. Otherwise, press Deploy New Version
.
The results will be shown in the text field at the top of the window.
Delete
Enter a deployment id you wish to delete into the text field. This will delete the deployment and remove the content folder for that version from the file system.
Last updated