Template Unity Package Introduction
Introduction to Nick Maltbie's Template Unity Package.
Usage
This project is intended to be used as a base for creating new unity packages. The goal for this is to make creating and sharing unity packages via git and npm easier for new projects. I'm creating this project so I have a template when I want to create a new package such as OpenKCC or ScreenManager.
This project contains a template setup for a unity package.
- Example package with example script.
- Automated testing validation in PlayMode and EditMode.
- Template
package.json
configuration.
This also includes the scripts and actions to upload
the build to an npm repo such as my example npm package
com.nickmaltbie.openkcc.
This also includes the scripts to create branches based on tags
and releases of the project in the setup-package.sh
file.
Features
Features of this template package include:
- Rename Script for Unity Assets
- Script to Create Package
- Automated GitHub Actions
- Documentation Website Template with DocFx
Rename Script
There is a script file at Assets\Editor\RenameAssets.cs
that
has steps to rename all the files in the project associated
with the template package (like the project name, website, company
name, etc...) as well as regenerate the project asset GUIDs
for unity to avoid asset collisions in multiple uses of
the template.
See the Rename Script page for further details.
Setup Package and Installation
The project contains a script, setup-package.sh
, to automate generating a
package either from the current commit or from a tag of the project. This will
then be saved to a new git branch preserving git-lfs
file hashes.
See the Package Setup page for instructions on how to setup and share the package generated by this script.
Automated GitHub actions
There are many automated github actions in
the project stored at .github/actions
Workflow | Description |
---|---|
build-verification.yml |
Verify that project can properly. |
create-package.yml |
Creates a package for a github branch and npmjs repo. |
deploy.yml |
Builds and deploys project to the github pages environment. |
format.yml |
Linting with markdownlint , dotnet format , and docfx . |
tests-validation.yml |
Runs test validation on the project. |
Please look at the workflow files for further details and documentation on the github repo.
There are some global configuration variables all fo the workflows
in the file .github/variables/projectconfig.env
.
And there are a few shared workflow scripts under .github/actions
folder
including:
git-lfs-cache
- Loads files fromgit-lfs
using a cache from the list of lfs files.setvars
- Loads variables from theprojectconfig.env
file.unity-library-cache
- Caches the unity library folders as part of github build.
See the GitHub Actions page for further details.
Documentation Template Website
In addition, this package includes a documentation website template that you can customize for your package. This website is part of the documentation template using docfx. This includes scripts to create the documentation website with docfx tool that includes API documentation. See the Documentation Website page for further details.