This repository contains two projects that integrate Unity development with Nx workspaces:
- An Nx plugin for Unity projects
- A Unity package to enable all plugin features
Location: packages/nx-unity
This plugin allows you to seamlessly integrate Unity projects into your Nx workspace. It provides custom executors and generators to streamline your Unity development workflow within the Nx ecosystem.
Location: packages/unity-package
This Unity package should be referenced in all Unity projects within your Nx workspace to fully utilize the features provided by the Nx plugin.
Install the Nx plugin in your Nx workspace:
npm install --save-dev nx-unity
If you want to start a new Unity project, generate one with the following command:
npx nx generate nx-unity:project
That's it! You can now open the generated Unity project in Unity Hub and start developing.
Integrating Nx into an existing Unity project is also possible, but requires manual setup.
- Create a
project.json
file in the root of your Unity project. Below is a minimal example with a build target for Windows:
{
"name": "client",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/<projectName>/Assets",
"targets": {
"build": {
"executor": "nx-unity:build",
"configurations": {
"windows": {
"executeMethod": "BuildCommands.BuildWindows"
}
},
"defaultConfiguration": "windows"
}
}
}
- Add the Unity package to the Unity project using OpenUPM:
npm install -g openupm-cli
openupm add com.danielkreitsch.nx-unity -r http://verdaccio.danielkreitsch.com
Encountered an issue or have suggestions for improvements? Feel free to raise an issue.
Contributions are welcome!