Unity Package Template

Unity Package Template

IvanMurzak

开发者工具
访问服务器

README

Unity Package Template (Unity 包模板)

<img width="100%" alt="Stats" src="https://user-images.githubusercontent.com/9135028/198754538-4dd93fc6-7eb2-42ae-8ac6-d7361c39e6ef.gif"/>

Unity Editor 支持 NPM 包。与 Unity 多年来使用的经典插件相比,它是一种更灵活的解决方案。 NPM 包支持版本控制和依赖项。您可以非常轻松地更新/降级任何包。此外,Unity Editor 具有 UPM(Unity Package Manager),这使得该过程更加简单。

此模板存储库旨在轻松更新为真正的 Unity 包。请按照以下说明进行操作,它将帮助您完成包的创建、分发和安装的整个过程。

Steps to make your package (创建包的步骤)

1️⃣ Click the button to create new repository on GitHub using this template. (单击按钮以使用此模板在 GitHub 上创建新存储库。)

create new repository

2️⃣ Clone your new repository and open it in Unity Editor (克隆您的新存储库并在 Unity Editor 中打开它)

3️⃣ Rename Package (重命名 Package)

您的包应该具有唯一的标识符。它被称为包的 name。它仅支持有限的符号。这是一个包名称的示例。

com.github.your_name.package
  • 👉 Instead of the word package use a word or couple of words that explains the main purpose of the package. (👉 使用一个或几个词来解释包的主要目的,而不是使用单词 package。)
  • 👉 The name should be unique in the world. (👉 name 在世界上应该是唯一的。)
Option 1: Use script to rename package (recommended) (选项 1:使用脚本重命名包(推荐))

For MacOS (对于 MacOS)


For Windows (对于 Windows)

cd Commands
.\package_rename.bat Username PackageName
Option 2: Manual package rename (选项 2:手动重命名包)

Follow the instruction - manual package rename (按照说明 - 手动重命名包)

3️⃣ Customize Assets/root/package.json (自定义 Assets/root/package.json)

  • 👉 Update name (👉 更新 name)

    Sample: com.github.your_name.package (示例:com.github.your_name.package) Instead of the word package use a word or couple of words that explains the main purpose of the package. (使用一个或几个词来解释包的主要目的,而不是使用单词 package。) The name should be unique in the world. (name 在世界上应该是唯一的。)

  • 👉 Update unity to setup minimum supported Unity version (👉 更新 unity 以设置最低支持的 Unity 版本)

  • 👉 Update (👉 更新)

    • displayName - visible name of the package, (displayName - 包的可见名称,)
    • version - the version of the package (1.0.0), (version - 包的版本 (1.0.0),)
    • description - short description of the package, (description - 包的简短描述,)
    • author - author of the package and url to the author (could be GitHub profile), (author - 包的作者和作者的 URL(可以是 GitHub 个人资料),)
    • keywords - array of keywords that describes the package. (keywords - 描述包的关键字数组。)

4️⃣ Do you need Tests? (您需要测试吗?)

<details> <summary><b>❌ NO</b></summary>

  • 👉 Delete Assets/root/Tests folder (👉 删除 Assets/root/Tests 文件夹)
  • 👉 Delete .github/workflows folder (👉 删除 .github/workflows 文件夹)

</details>

<details> <summary><b>✅ YES</b></summary>

  • 👉 Make sure you executed package-rename script from the step #2. If not, please follow manual package rename instructions (👉 确保您已执行步骤 #2 中的 package-rename 脚本。 如果没有,请按照 手动重命名包 说明进行操作)

  • 👉 Add GitHub Secrets (👉 添加 GitHub Secrets)

    At the GitHub repository, go to "Settings", then "Secrets and Variables", then "Actions", then click on "New repository secret" (在 GitHub 存储库中,转到“Settings”,然后转到“Secrets and Variables”,然后转到“Actions”,然后单击“New repository secret”)

    1. Add UNITY_EMAIL - email of your Unity ID's account (添加 UNITY_EMAIL - 您的 Unity ID 帐户的电子邮件)
    2. Add UNITY_PASSWORD - password of your Unity ID's account (添加 UNITY_PASSWORD - 您的 Unity ID 帐户的密码)
    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 (添加 UNITY_LICENSE - 许可证内容。 可以从 Unity_lic.ulf 文件中获取。 只需在任何文本编辑器中打开它并复制整个内容)
      1. Windows: The Unity_lic.ulf file is located at C:/ProgramData/Unity/Unity_lic.ulf (Windows:Unity_lic.ulf 文件位于 C:/ProgramData/Unity/Unity_lic.ulf)
      2. MacOS: /Library/Application Support/Unity/Unity_lic.ulf (MacOS: /Library/Application Support/Unity/Unity_lic.ulf)
      3. Linux: ~/.local/share/unity3d/Unity/Unity_lic.ulf (Linux: ~/.local/share/unity3d/Unity/Unity_lic.ulf)

</details>

4️⃣ Add files into Assets/root folder (将文件添加到 Assets/root 文件夹)

Unity guidelines about organizing files into the package root directory (有关将文件组织到包根目录中的 Unity 指南)

  <root>
  ├── package.json
  ├── README.md
  ├── CHANGELOG.md
  ├── LICENSE.md
  ├── Third Party Notices.md
  ├── Editor
  │   ├── [company-name].[package-name].Editor.asmdef
  │   └── EditorExample.cs
  ├── Runtime
  │   ├── [company-name].[package-name].asmdef
  │   └── RuntimeExample.cs
  ├── Tests
  │   ├── Editor
  │   │   ├── [company-name].[package-name].Editor.Tests.asmdef
  │   │   └── EditorExampleTest.cs
  │   └── Runtime
  │        ├── [company-name].[package-name].Tests.asmdef
  │        └── RuntimeExampleTest.cs
  ├── Samples~
  │        ├── SampleFolder1
  │        ├── SampleFolder2
  │        └── ...
  └── Documentation~
       └── [package-name].md
Final polishing (最后的润色)
  • Update the README.md file (this file) with information about your package. (使用有关您的包的信息更新 README.md 文件(此文件)。)
  • Copy the updated README.md to Assets/root as well. (将更新后的 README.md 也复制到 Assets/root。)

⚠️ 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. (⚠️ root 文件夹之外的所有内容都不会添加到您的包中。 但仍然可以用于在您的存储库中测试或展示您的包。)

5️⃣ Deploy to any registry you like (部署到您喜欢的任何注册表)

6️⃣ Install your package into Unity Project (将您的包安装到 Unity 项目中)

When your package is distributed, you can install it into any Unity project. (当您的包分发后,您可以将其安装到任何 Unity 项目中。)

Don't install into the same Unity project, please use another one. (不要安装到同一个 Unity 项目中,请使用另一个。)

  • Install OpenUPM-CLI (安装 OpenUPM-CLI)

  • Open a command line at the root of Unity project (the folder which contains Assets) (在 Unity 项目的根目录(包含 Assets 的文件夹)打开命令行)

  • Execute the command (for OpenUPM hosted package) (执行命令(对于 OpenUPM 托管的包))

    openupm add YOUR_PACKAGE_NAME
    

Final view in Unity Package Manager (Unity Package Manager 中的最终视图)

image

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript