├── .github ├── FUNDING.yml └── workflows │ ├── 2023.2.20f1_build.yml │ ├── 2023.2.20f1_editor.yml │ ├── 2023.2.20f1_player.yml │ ├── 6000.0.37f1_build.yml │ ├── 6000.0.37f1_editor.yml │ ├── 6000.0.37f1_player.yml │ └── main.yml ├── .gitignore ├── Assets └── root │ ├── CHANGELOG.md │ ├── Documentation~ │ └── .gitignore │ ├── Editor │ ├── Gizmos │ │ ├── .gitignore │ │ └── icon.png │ └── Scripts │ │ ├── .gitignore │ │ └── Package.Editor.asmdef │ ├── LICENSE │ ├── Runtime │ ├── .gitignore │ └── Package.Runtime.asmdef │ ├── Samples~ │ └── .gitignore │ ├── Tests │ ├── Editor │ │ ├── .gitignore │ │ └── Package.Editor.Tests.asmdef │ └── Runtime │ │ ├── .gitignore │ │ └── Package.Tests.asmdef │ └── package.json ├── Commands ├── clean_template.bat ├── copy_readme.bat ├── git_push_to_upm_branch.bat ├── git_push_to_upm_branch.makefile ├── github_draft_release.bat ├── github_release.bat ├── npm_add_user.bat ├── npm_deploy.bat ├── npm_update_dependencies.bat ├── npm_version_major.bat ├── npm_version_minor.bat ├── npm_version_patch.bat └── package_rename.bat ├── Docs ├── Deploy-GitHub.md ├── Deploy-OpenUPM.md ├── Deploy-npmjs.md └── Manual-Package-Rename.md ├── LICENSE └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: IvanMurzak 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /.github/workflows/2023.2.20f1_build.yml: -------------------------------------------------------------------------------- 1 | name: 2023.2.20f1-Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '2023.2.20f1' 17 | testMode: 'standalone' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/2023.2.20f1_editor.yml: -------------------------------------------------------------------------------- 1 | name: 2023.2.20f1-Editor 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '2023.2.20f1' 17 | testMode: 'editmode' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/2023.2.20f1_player.yml: -------------------------------------------------------------------------------- 1 | name: 2023.2.20f1-Player 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '2023.2.20f1' 17 | testMode: 'playmode' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/6000.0.37f1_build.yml: -------------------------------------------------------------------------------- 1 | name: 6000.0.37f1-Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '6000.0.37f1' 17 | testMode: 'standalone' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/6000.0.37f1_editor.yml: -------------------------------------------------------------------------------- 1 | name: 6000.0.37f1-Editor 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '6000.0.37f1' 17 | testMode: 'editmode' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/6000.0.37f1_player.yml: -------------------------------------------------------------------------------- 1 | name: 6000.0.37f1-Player 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | editor-tests: 13 | uses: ./.github/workflows/main.yml 14 | with: 15 | projectPath: './' 16 | unityVersion: '6000.0.37f1' 17 | testMode: 'playmode' 18 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Editor Tests 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | projectPath: 7 | required: true 8 | type: string 9 | unityVersion: 10 | required: true 11 | type: string 12 | testMode: 13 | required: true 14 | type: string 15 | secrets: 16 | UNITY_LICENSE: 17 | required: true 18 | UNITY_EMAIL: 19 | required: true 20 | UNITY_PASSWORD: 21 | required: true 22 | 23 | jobs: 24 | test: 25 | name: ${{ inputs.unityVersion }} ${{ inputs.testMode }} 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v4 29 | with: 30 | lfs: false 31 | - uses: actions/cache@v4 32 | with: 33 | path: ${{ inputs.projectPath }}/Library 34 | key: Library-${{ inputs.unityVersion }} 35 | restore-keys: | 36 | Library- 37 | - uses: game-ci/unity-test-runner@v4 38 | id: tests 39 | env: 40 | UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} 41 | UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} 42 | UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} 43 | with: 44 | projectPath: ${{ inputs.projectPath }} 45 | unityVersion: ${{ inputs.unityVersion }} 46 | testMode: ${{ inputs.testMode }} 47 | artifactsPath: ${{ inputs.testMode }}-artifacts 48 | githubToken: ${{ secrets.GITHUB_TOKEN }} 49 | checkName: ${{ inputs.unityVersion }} ${{ inputs.testMode }} Test Results -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Docs/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | */AndroidLogcatSettings.asset 62 | /Assets/StreamingAssets 63 | 64 | # Crashlytics generated file 65 | crashlytics-build.properties 66 | 67 | # ODIN Ignore the auto-generated AOT compatibility dll. 68 | /Assets/Plugins/Sirenix/Assemblies/AOT/* 69 | /Assets/Plugins/Sirenix/Assemblies/AOT** 70 | 71 | # ODIN Ignore all unpacked demos. 72 | /Assets/Plugins/Sirenix/Demos/* 73 | 74 | # ODIN plugin 75 | /Assets/Plugins/Sirenix** 76 | -------------------------------------------------------------------------------- /Assets/root/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.1] - 2025-03-29 4 | ### Fixed 5 | - Resolved a bug causing crashes when initializing the package on Unity 2021.3. 6 | - Fixed incorrect behavior in the custom editor window. 7 | 8 | ## [1.0.0] - 2025-03-15 9 | ### Added 10 | - Initial release of the Unity package. 11 | - Added core functionality for A, B, and C. 12 | - Included documentation and example scenes. -------------------------------------------------------------------------------- /Assets/root/Documentation~/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Editor/Gizmos/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Editor/Gizmos/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IvanMurzak/Unity-Package-Template/923f414ef46847b028e2997e19c762527b71b639/Assets/root/Editor/Gizmos/icon.png -------------------------------------------------------------------------------- /Assets/root/Editor/Scripts/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Editor/Scripts/Package.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Package.Editor", 3 | "references": [ 4 | "Package.Runtime" 5 | ], 6 | "includePlatforms": [], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Assets/root/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Ivan Murzak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Assets/root/Runtime/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Runtime/Package.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Package.Runtime", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [ 6 | "Editor" 7 | ], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Assets/root/Samples~/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Tests/Editor/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Tests/Editor/Package.Editor.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Package.Editor.Tests", 3 | "references": [ 4 | "UnityEngine.TestRunner", 5 | "UnityEditor.TestRunner", 6 | "Package.Runtime", 7 | "Package.Editor" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": true, 15 | "precompiledReferences": [ 16 | "nunit.framework.dll" 17 | ], 18 | "autoReferenced": false, 19 | "defineConstraints": [ 20 | "UNITY_INCLUDE_TESTS" 21 | ], 22 | "versionDefines": [], 23 | "noEngineReferences": false 24 | } -------------------------------------------------------------------------------- /Assets/root/Tests/Runtime/.gitignore: -------------------------------------------------------------------------------- 1 | # Except this file 2 | !.gitignore -------------------------------------------------------------------------------- /Assets/root/Tests/Runtime/Package.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Package.Tests", 3 | "references": [ 4 | "UnityEngine.TestRunner", 5 | "Package.Runtime" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": true, 11 | "precompiledReferences": [ 12 | "nunit.framework.dll" 13 | ], 14 | "autoReferenced": false, 15 | "defineConstraints": [ 16 | "UNITY_INCLUDE_TESTS" 17 | ], 18 | "versionDefines": [], 19 | "noEngineReferences": false 20 | } -------------------------------------------------------------------------------- /Assets/root/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.github.your_name.package", 3 | "displayName": "Package", 4 | "author": { 5 | "name": "Your_Name", 6 | "url": "https://github.com/Your_Name" 7 | }, 8 | "keywords": [ 9 | "keyword1", 10 | "keyword2" 11 | ], 12 | "version": "1.0.0", 13 | "unity": "2019.4", 14 | "description": "Some description", 15 | "dependencies": {} 16 | } -------------------------------------------------------------------------------- /Commands/clean_template.bat: -------------------------------------------------------------------------------- 1 | cd .. 2 | rmdir /s /q "ProjectSettings" 3 | rmdir /s /q "Packages" 4 | rmdir /s /q ".vscode" 5 | 6 | for /r %%f in (*.meta) do ( 7 | del /f /q "%%f" 8 | ) 9 | 10 | del /f /q "Unity-Package-Template.sln" 11 | 12 | echo Done! 13 | pause -------------------------------------------------------------------------------- /Commands/copy_readme.bat: -------------------------------------------------------------------------------- 1 | xcopy ..\README.md ..\Assets\root\README.md* /Y 2 | xcopy ..\README.md ..\Assets\root\Documentation~\README.md* /Y -------------------------------------------------------------------------------- /Commands/git_push_to_upm_branch.bat: -------------------------------------------------------------------------------- 1 | cd .. 2 | git subtree push --prefix Assets/root origin upm 3 | pause -------------------------------------------------------------------------------- /Commands/git_push_to_upm_branch.makefile: -------------------------------------------------------------------------------- 1 | deploy: 2 | cd .. 3 | git subtree push --prefix Assets/root origin upm -------------------------------------------------------------------------------- /Commands/github_draft_release.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | @echo off 3 | echo ---------------------------------------------------- 4 | echo Executing "npm pkg get version" 5 | FOR /F "tokens=* USEBACKQ" %%F IN (`npm pkg get version`) DO ( 6 | SET RawVersion=%%F 7 | ) 8 | echo Version of current package is extracted: %RawVersion% 9 | SET CleanVersion=%RawVersion:~1,-1% 10 | echo Current version: %CleanVersion% 11 | 12 | git push -u origin HEAD 13 | 14 | echo ---------------------------------------------------- 15 | cd ..\..\ 16 | echo Creating GitHub release with tag=%CleanVersion% 17 | @echo on 18 | gh release create %CleanVersion% --draft --generate-notes --title %CleanVersion% 19 | gh repo view --web 20 | @echo off 21 | echo ---------------------------------------------------- 22 | 23 | pause 24 | -------------------------------------------------------------------------------- /Commands/github_release.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | @echo off 3 | echo ---------------------------------------------------- 4 | echo Executing "npm pkg get version" 5 | FOR /F "tokens=* USEBACKQ" %%F IN (`npm pkg get version`) DO ( 6 | SET RawVersion=%%F 7 | ) 8 | echo Version of current package is extracted: %RawVersion% 9 | SET CleanVersion=%RawVersion:~1,-1% 10 | echo Current version: %CleanVersion% 11 | 12 | git push -u origin HEAD 13 | 14 | echo ---------------------------------------------------- 15 | cd ..\..\ 16 | echo Creating GitHub release with tag=%CleanVersion% 17 | @echo on 18 | gh release create %CleanVersion% --generate-notes --title %CleanVersion% 19 | gh release view %CleanVersion% --web 20 | @echo off 21 | echo ---------------------------------------------------- 22 | 23 | pause 24 | -------------------------------------------------------------------------------- /Commands/npm_add_user.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | npm adduser -------------------------------------------------------------------------------- /Commands/npm_deploy.bat: -------------------------------------------------------------------------------- 1 | xcopy ..\README.md ..\Assets\root\README.md* /Y 2 | xcopy ..\README.md ..\Assets\root\Documentation~\README.md* /Y 3 | cd ..\Assets\root 4 | npm publish 5 | pause -------------------------------------------------------------------------------- /Commands/npm_update_dependencies.bat: -------------------------------------------------------------------------------- 1 | call npm --prefix ..\Assets\root update 2 | del /f ..\Assets\root\package-lock.* 3 | pause -------------------------------------------------------------------------------- /Commands/npm_version_major.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | npm version major 3 | pause -------------------------------------------------------------------------------- /Commands/npm_version_minor.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | npm version minor 3 | pause -------------------------------------------------------------------------------- /Commands/npm_version_patch.bat: -------------------------------------------------------------------------------- 1 | cd ..\Assets\root 2 | npm version patch 3 | pause -------------------------------------------------------------------------------- /Commands/package_rename.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Started package rename process. 3 | 4 | echo Change to the target directory 5 | cd ..\Assets\root || ( 6 | echo Failed to change directory to ..\Assets\root 7 | exit /b 1 8 | ) 9 | 10 | echo Username: %~1 11 | echo Package Name: %~2 12 | 13 | echo Check if the correct number of arguments is provided 14 | if "%~2"=="" ( 15 | echo Usage: package_rename.bat {username} {packageName} 16 | exit /b 1 17 | ) 18 | 19 | echo Debugging: Reading arguments 20 | set "username=%~1" 21 | set "packageName=%~2" 22 | 23 | echo Debugging: Converting to lowercase 24 | for /f "usebackq delims=" %%A in (`powershell -Command "$env:packageName.ToLower()"`) do set "lowerPackageName=%%A" 25 | for /f "usebackq delims=" %%A in (`powershell -Command "$env:username.ToLower()"`) do set "lowerUsername=%%A" 26 | 27 | echo Debugging: SetLocal 28 | setlocal enabledelayedexpansion 29 | 30 | REM Debugging: Print variables 31 | echo Username: %username% 32 | echo PackageName: %packageName% 33 | echo Lowercase PackageName: !lowerPackageName! 34 | echo Lowercase Username: !lowerUsername! 35 | 36 | REM Recursively replace "package" and "Package" in file content, ignoring .md and .meta files 37 | for /r %%F in (*) do ( 38 | REM Check if the file ends with .md or .meta 39 | if /i "%%~xF"==".asmdef" ( 40 | REM Process the file 41 | echo Processing file: %%F 42 | powershell -Command "(Get-Content -Raw -Path '%%F') -replace 'Package', '%packageName%' -replace 'package', '!lowerPackageName!' -replace 'Your_Name', '%username%' -replace 'your_name', '!lowerUsername!' | Set-Content -Path '%%F'" || ( 43 | echo Failed to process file %%F 44 | ) 45 | ) 46 | if /i "%%~nxF"=="package.json" ( 47 | REM Process the file 48 | echo Processing file: %%F 49 | powershell -Command "(Get-Content -Raw -Path '%%F') -replace 'Package', '%packageName%' -replace 'package', '!lowerPackageName!' -replace 'Your_Name', '%username%' -replace 'your_name', '!lowerUsername!' | Set-Content -Path '%%F'" || ( 50 | echo Failed to process file %%F 51 | ) 52 | ) 53 | ) 54 | 55 | REM Recursively rename files with "package" and "Package" in their names, ignoring .md files 56 | for /r %%F in (*) do ( 57 | if /i "%%~xF"==".asmdef" ( 58 | set "newName=%%~nxF" 59 | set "newName=!newName:Package=%packageName%!" 60 | if not "%%~nxF"=="!newName!" ( 61 | ren "%%F" "!newName!" || ( 62 | echo Failed to rename file %%F 63 | ) 64 | ) 65 | ) 66 | ) 67 | 68 | echo Done! 69 | pause -------------------------------------------------------------------------------- /Docs/Deploy-GitHub.md: -------------------------------------------------------------------------------- 1 | # Deploy your package using `GitHub` 2 | 3 | GitHub public repository could be used as a host for your package and directly imported into Unity project from GitHub repository. 4 | 5 | > ⚠️ GitHub distribution method doesn't support automatic dependency resolving. Recommended to deploy package to OpenUPM if your package has dependencies. Also, you would need to use only OpenUPM-CLI to resolve dependencies automatically. 6 | 7 | ## Deploy 8 | 9 | 1. Increment package version in the file `Assets/root/package.json`. It has `version` property. 10 | > Any further updates should be done by incrementing package version and making another GitHub release. 11 | 2. Create GitHub Release 12 | 1. Go to your GitHub repository 13 | 2. Click on `Releases` 14 | 3. Click on `Draft a new release` 15 | 4. Use `tag` that is equals to your package version name 16 | 17 | # Installation 18 | 19 | ### Option 1: Using Package Manager (recommended) 20 | 21 | - Open `Package Manager` in Unity Editor 22 | - Click on the small `+` button in the top left corner 23 | - Select `Add package from git URL` 24 | - Paste URL to your GitHub repository with simple modification: 25 | `https://github.com/USER/REPO.git` 26 | Don't forget to replace **USER** and **REPO** to yours 27 | 28 | #### **Or** you may use special version if you made one 29 | 30 | > To make a version at GitHub, you may need to create Tag with the version name. Also, I would recommend to make a GitHub Release as well. 31 | 32 | `https://github.com/USER/REPO.git#v1.0.0` 33 | Don't forget to replace **USER** and **REPO** to yours 34 | 35 | ### Option 2: Manual 36 | 37 | Modify `manifest.json` file. Need to add the line into your's `dependencies` object. Change `your.package.name` to the name of your package. And replace **USER** and **REPO** to yours. 38 | 39 | ```json 40 | { 41 | "dependencies": { 42 | "your.package.name": "https://github.com/USER/REPO.git" 43 | } 44 | } 45 | ``` 46 | 47 | #### **Or** you may use special version if you create one 48 | 49 | Don't forget to replace **USER** and **REPO** to yours. 50 | 51 | ```json 52 | { 53 | "dependencies": { 54 | "your.package.name": "https://github.com/USER/REPO.git#v1.0.0" 55 | } 56 | } 57 | ``` 58 | -------------------------------------------------------------------------------- /Docs/Deploy-OpenUPM.md: -------------------------------------------------------------------------------- 1 | # Deploy your package to `OpenUPM` 2 | 3 | OpenUPM is a registry of package made for Unity. It takes package sources from GitHub repository. That is why your package repository should be public. And your package should be manually submitted for the first time to OpenUPM to be registered in the index. Time to time OpenUPM would fetch fresh data from GitHub to identify package updates if any. 4 | 5 | ### Do just once 6 | 7 | 1. [Submit package to OpenUPM registry](https://openupm.com/packages/add/). Use link to your GitHub repository. **This should be done just once!** 8 | 9 | ### Do each update 10 | 11 | ⚠️ Make sure you done editing `package.json` and files in `Assets/root` folder. Because it is going to be public with no ability to discard it. 12 | 13 | 1. Increment package version in the file `Assets/root/package.json`. It has `version` property. 14 | > Any further updates should be done with incrementing package version and making another GitHub release. 15 | > Versions lower than `1.0.0` is represented in Unity as "preview". 16 | 2. Create GitHub Release 17 | 1. Go to your GitHub repository 18 | 2. Click on `Releases` 19 | 3. Click on `Draft a new release` 20 | 4. Use `tag` that is equals to your package version name 21 | 22 | # Installation 23 | 24 | When your package is distributed, you can install it into any Unity project. 25 | 26 | - [Install OpenUPM-CLI](https://github.com/openupm/openupm-cli#installation) 27 | - Open the command line in the Unity project folder 28 | - Run the command 29 | 30 | ```bash 31 | openupm add YOUR_PACKAGE_NAME 32 | ``` 33 | 34 | ### Alternative manual installation 35 | 36 | If for any reason you don't want to use OpenUPM-CLI there is a manual approach. 37 | 38 | Modify `manifest.json` file. 39 | 40 | - Add the line into your's `dependencies` object 41 | - Change `your.package.name` to the name of your package 42 | - Replace **USER** and **REPO** to yours 43 | - Add `scopedRegistries` 44 | - Change `your.package.name` to the name of your package 45 | 46 | ```json 47 | { 48 | "dependencies": { 49 | "your.package.name": "1.0.0" 50 | }, 51 | "scopedRegistries": [ 52 | { 53 | "name": "OpenUPM", 54 | "url": "https://package.openupm.com", 55 | "scopes": [ 56 | "your.package.name" 57 | ] 58 | } 59 | ], 60 | } 61 | ``` 62 | 63 | --- 64 | 65 | ### Good to know 66 | 67 | > Make sure you made a new `Release` at GitHub 68 | > Make sure the GitHub repository is public 69 | > OpenUPM may take some time to index your new package or an update of your package. Usually up to 30 minutes. 70 | -------------------------------------------------------------------------------- /Docs/Deploy-npmjs.md: -------------------------------------------------------------------------------- 1 | # Deploy your package to `npmjs.com` using `npm` 2 | 3 | `npmjs.com` is a very popular registry for wide range of packages. It was not designed to host Unity related packages, but it works. If for any reason still need to use it, there is the tutorial how to make it work. 4 | 5 | ### Preparation (just once) 6 | 7 | - Install [NPM](https://nodejs.org/en/download/) 8 | - Create [NPMJS](https://npmjs.com) account 9 | - Open `Commands` folder 10 | - Run the script `npm_add_user.bat` and sign-in to your account 11 | 12 |
13 | npm_add_user.bat script content 14 | 15 | It executes `npm adduser` command in the package root folder 16 | 17 | ```bash 18 | cd ..\Assets\root 19 | npm adduser 20 | ``` 21 | 22 |
23 | 24 | ### Deploy 25 | 26 | ⚠️ Make sure you done editing `package.json` and files in `Assets/root` folder. Because it is going to be public with no ability to discard it. 27 | 28 | 1. Increment `version` in `package.json` file 29 | > Any further updates should be done with incrementing package version. 30 | > Versions lower than `1.0.0` is represented in Unity as "preview". 31 | 2. Open `Commands` folder 32 | 3. Run the script `npm_deploy.bat` to publish your package to the public 33 | 34 |
35 | npm_deploy.bat script content 36 | 37 | The first line in the script copies the `README.md` file to the package root. Because the README should be in a package also, that is a part of the package format. 38 | It executes `npm publish` command in the package root folder. The command publishes your package to the NPMJS platform automatically 39 | 40 | ```bash 41 | xcopy ..\README.md ..\Assets\root\README.md* /Y 42 | xcopy ..\README.md ..\Assets\root\Documentation~\README.md* /Y 43 | cd ..\Assets\root 44 | npm publish 45 | pause 46 | ``` 47 | 48 |
49 | 50 | # Installation 51 | 52 | When your package is distributed, you can install it into any Unity project. 53 | 54 | - [Install OpenUPM-CLI](https://github.com/openupm/openupm-cli#installation) 55 | - Open the command line in the Unity project folder 56 | - Run the command 57 | 58 | ```bash 59 | openupm --registry https://registry.npmjs.org add YOUR_PACKAGE_NAME 60 | ``` 61 | 62 | ### Alternative manual installation 63 | 64 | If for any reason you don't want to use OpenUPM-CLI there is a manual approach. 65 | 66 | Modify `manifest.json` file. 67 | 68 | - Add the line into your's `dependencies` object 69 | - Change `your.package.name` to the name of your package 70 | - Replace **USER** and **REPO** to yours 71 | - Add `scopedRegistries` 72 | - Change `your.package.name` to the name of your package 73 | 74 | ```json 75 | { 76 | "dependencies": { 77 | "your.package.name": "1.0.0" 78 | }, 79 | "scopedRegistries": [ 80 | { 81 | "name": "npmjs", 82 | "url": "https://registry.npmjs.org", 83 | "scopes": [ 84 | "your.package.name" 85 | ] 86 | } 87 | ], 88 | } 89 | ``` 90 | -------------------------------------------------------------------------------- /Docs/Manual-Package-Rename.md: -------------------------------------------------------------------------------- 1 | # Manual `Package` rename 2 | 3 | #### 1️⃣ Customize `Assets/root/package.json` 4 | 5 | - 👉 **Update** `name` 6 | > Sample: `com.github.your_name.package` 7 | > Instead of the word `package` use a word or couple of words that explains the main purpose of the package. 8 | 9 | - 👉 **Update** `unity` to setup minimum supported Unity version 10 | - 👉 **Update** `displayName`, `version`, `description`, `author`, `keywords` to your needs 11 | 12 | #### 2️⃣ Do you need Tests? 13 | 14 |
15 | ❌ NO - click 16 | 17 | - 👉 **Delete** `Assets/root/Tests` folder 18 | - 👉 **Delete** `.github/workflows` folder 19 | 20 |
21 | 22 |
23 | ✅ YES - click 24 | 25 | - 👉 **Repeat** these actions for these files. 26 | 27 | - Update the files: 28 | - `Assets/root/Tests/Base/Package.Editor.Tests.asmdef` 29 | - `Assets/root/Tests/Base/Package.Tests.asmdef` 30 | 31 | - Apply these actions to files above: 32 | - 👉 **Rename** the `Package` part of the file name 33 | - 👉 **Replace** the `Package` keyword in the file content (multiple places) 34 | 35 |
36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Ivan Murzak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Package Template 2 | 3 | Stats 4 | 5 | Unity Editor supports NPM packages. It is way more flexible solution in comparison with classic Plugin that Unity is using for years. NPM package supports versioning and dependencies. You may update / downgrade any package very easily. Also, Unity Editor has UPM (Unity Package Manager) that makes the process even simpler. 6 | 7 | This template repository is designed to be easily updated into a real Unity package. Please follow the instruction bellow, it will help you to go through the entire process of package creation, distribution and installing. 8 | 9 | # Steps to make your package 10 | 11 | #### 1️⃣ Click the button to create new repository on GitHub using this template. 12 | 13 | [![create new repository](https://user-images.githubusercontent.com/9135028/198753285-3d3c9601-0711-43c7-a8f2-d40ec42393a2.png)](https://github.com/IvanMurzak/Unity-Package-Template/generate) 14 | 15 | #### 2️⃣ Clone your new repository and open it in Unity Editor 16 | 17 | #### 3️⃣ Rename `Package` 18 | 19 | Your package should have unique identifier. It is called a `name` of the package. It support only limited symbols. There is a sample of the package name. 20 | 21 | ```text 22 | com.github.your_name.package 23 | ``` 24 | 25 | - 👉 Instead of the word `package` use a word or couple of words that explains the main purpose of the package. 26 | - 👉 The `name` should be unique in the world. 27 | 28 | ###### Option 1: Use script to rename package (recommended) 29 | 30 | For MacOS 31 | 32 | ```bash 33 | 34 | ``` 35 | 36 | For Windows 37 | 38 | ```bash 39 | cd Commands 40 | .\package_rename.bat Username PackageName 41 | ``` 42 | 43 | ###### Option 2: Manual package rename 44 | 45 | Follow the instruction - [manual package rename](https://github.com/IvanMurzak/Unity-Package-Template/blob/main/Docs/Manual-Package-Rename.md) 46 | 47 | 48 | #### 3️⃣ Customize `Assets/root/package.json` 49 | 50 | - 👉 **Update** `name` 51 | > Sample: `com.github.your_name.package` 52 | > Instead of the word `package` use a word or couple of words that explains the main purpose of the package. 53 | > The `name` should be unique in the world. 54 | 55 | - 👉 **Update** `unity` to setup minimum supported Unity version 56 | - 👉 **Update** 57 | - `displayName` - visible name of the package, 58 | - `version` - the version of the package (1.0.0), 59 | - `description` - short description of the package, 60 | - `author` - author of the package and url to the author (could be GitHub profile), 61 | - `keywords` - array of keywords that describes the package. 62 | 63 | #### 4️⃣ Do you need Tests? 64 | 65 |
66 | ❌ NO 67 | 68 | - 👉 **Delete** `Assets/root/Tests` folder 69 | - 👉 **Delete** `.github/workflows` folder 70 | 71 |
72 | 73 |
74 | ✅ YES 75 | 76 | - 👉 Make sure you executed `package-rename` script from the step #2. If not, please follow [manual package rename](https://github.com/IvanMurzak/Unity-Package-Template/blob/main/Docs/Manual-Package-Rename.md) instructions 77 | 78 | - 👉 Add GitHub Secrets 79 | > At the GitHub repository, go to "Settings", then "Secrets and Variables", then "Actions", then click on "New repository secret" 80 | 1. Add `UNITY_EMAIL` - email of your Unity ID's account 81 | 2. Add `UNITY_PASSWORD` - password of your Unity ID's account 82 | 3. Add `UNITY_LICENSE` - license content. Could be taken from `Unity_lic.ulf` file. Just open it in any text editor and copy the entire content 83 | 1. Windows: The `Unity_lic.ulf` file is located at `C:/ProgramData/Unity/Unity_lic.ulf` 84 | 2. MacOS: `/Library/Application Support/Unity/Unity_lic.ulf` 85 | 3. Linux: `~/.local/share/unity3d/Unity/Unity_lic.ulf` 86 | 87 |
88 | 89 | #### 4️⃣ Add files into `Assets/root` folder 90 | 91 | [Unity guidelines](https://docs.unity3d.com/Manual/cus-layout.html) about organizing files into the package root directory 92 | 93 | ```text 94 | 95 | ├── package.json 96 | ├── README.md 97 | ├── CHANGELOG.md 98 | ├── LICENSE.md 99 | ├── Third Party Notices.md 100 | ├── Editor 101 | │ ├── [company-name].[package-name].Editor.asmdef 102 | │ └── EditorExample.cs 103 | ├── Runtime 104 | │ ├── [company-name].[package-name].asmdef 105 | │ └── RuntimeExample.cs 106 | ├── Tests 107 | │ ├── Editor 108 | │ │ ├── [company-name].[package-name].Editor.Tests.asmdef 109 | │ │ └── EditorExampleTest.cs 110 | │ └── Runtime 111 | │ ├── [company-name].[package-name].Tests.asmdef 112 | │ └── RuntimeExampleTest.cs 113 | ├── Samples~ 114 | │ ├── SampleFolder1 115 | │ ├── SampleFolder2 116 | │ └── ... 117 | └── Documentation~ 118 | └── [package-name].md 119 | ``` 120 | 121 | ##### Final polishing 122 | 123 | - Update the `README.md` file (this file) with information about your package. 124 | - Copy the updated `README.md` to `Assets/root` as well. 125 | 126 | > ⚠️ Everything outside of the `root` folder won't be added to your package. But still could be used for testing or showcasing your package at your repository. 127 | 128 | #### 5️⃣ Deploy to any registry you like 129 | 130 | - [Deploy to OpenUPM](https://github.com/IvanMurzak/Unity-Package-Template/blob/main/Docs/Deploy-OpenUPM.md) (recommended) 131 | - [Deploy using GitHub](https://github.com/IvanMurzak/Unity-Package-Template/blob/main/Docs/Deploy-GitHub.md) 132 | - [Deploy to npmjs.com](https://github.com/IvanMurzak/Unity-Package-Template/blob/main/Docs/Deploy-npmjs.md) 133 | 134 | #### 6️⃣ Install your package into Unity Project 135 | 136 | When your package is distributed, you can install it into any Unity project. 137 | 138 | > Don't install into the same Unity project, please use another one. 139 | 140 | - [Install OpenUPM-CLI](https://github.com/openupm/openupm-cli#installation) 141 | - Open a command line at the root of Unity project (the folder which contains `Assets`) 142 | - Execute the command (for `OpenUPM` hosted package) 143 | 144 | ```bash 145 | openupm add YOUR_PACKAGE_NAME 146 | ``` 147 | 148 | # Final view in Unity Package Manager 149 | 150 | ![image](https://user-images.githubusercontent.com/9135028/198777922-fdb71949-aee7-49c8-800f-7db885de9453.png) 151 | --------------------------------------------------------------------------------