fzhangtj
6 年前
当前提交
2d3ecb43
共有 31 个文件被更改,包括 64 次插入 和 442 次删除
-
2Assets.meta
-
405README.md
-
1Runtime/RuntimeExample.cs
-
1Runtime/painting/text_style.cs
-
4Tests/Editor/EditableTextWiget.cs
-
4Tests/Editor/Paragraph.cs
-
2Tests/Editor/RenderEditable.cs
-
4Tests/Editor/Widgets.cs
-
2Tests/Editor/Unity.UIWidgets.Editor.Tests.asmdef
-
18Samples/UIWidgetSample/ToDoAppCanvas.cs
-
18Samples/UIWidgetSample/AsScreenCanvas.cs
-
8Samples/UIWidgetSample.meta
-
5Samples/UIWidgetSample/.sample.json
-
6Samples/UIWidgetSample/UIWidgetSample.asmdef
-
7Samples/UIWidgetSample/UIWidgetSample.asmdef.meta
-
8Assets/UIWidgets.meta
-
3Assets/UIWidgetsSample.meta
-
8Samples/Example.meta
-
0/Tests/Editor/Unity.UIWidgets.Editor.Tests.asmdef.meta
-
0/Tests/Editor/Unity.UIWidgets.Editor.Tests.asmdef
-
0/Samples/UIWidgetSample/UIWidgetSample.unity.meta
-
0/Samples/UIWidgetSample/ToDoAppCanvas.cs
-
0/Samples/UIWidgetSample/AsScreenCanvas.cs
-
0/Samples/UIWidgetSample/AsScreenCanvas.cs.meta
-
0/Samples/UIWidgetSample/ToDoAppCanvas.cs.meta
-
0/Samples/UIWidgetSample/UIWidgetSample.unity
-
0/Samples/UIWidgetSample/SampleExample.cs
-
0/Samples/UIWidgetSample/SampleExample.cs.meta
|
|||
# UPM Package Starter Kit |
|||
|
|||
The purpose of this package template starter kit is to provide the data structure and development guidelines for new packages meant for the **Unity Package Manager (UPM)**. |
|||
|
|||
This is the first of many steps towards an automated package publishing experience within Unity. This package template starter kit is merely a fraction of the creation, edition, validation, and publishing tools that we will end up with. |
|||
|
|||
We hope you enjoy your experience. You can use **#devs-packman** on Slack to provide feedback or ask questions regarding your package development efforts. |
|||
|
|||
## Are you ready to become a package? |
|||
The Package Manager is a work-in-progress for Unity and, in that sense, there are a few criteria that must be met for your package to be considered on the package list at this time: |
|||
- **Your code accesses public Unity C# APIs only.** If you have a native code component, it will need to ship with an official editor release. Internal API access might eventually be possible for Unity made packages, but not at this time. |
|||
- **Your code doesn't require security, obfuscation, or conditional access control.** Anyone should be able to download your package and access the source code. |
|||
- **You have no urgent need to release your package.** Our current target for new packages is aligned with 2018.1. Although, based on upcoming package requests and limited packman capacity, that release date is not assured for any package. |
|||
- **You are willing to bleed with us a little!** Packman is still in development, and therefore has a few rough edges that will require patience and workarounds. |
|||
|
|||
## Package structure |
|||
|
|||
```none |
|||
<root> |
|||
├── package.json |
|||
├── README.md |
|||
├── CHANGELOG.md |
|||
├── LICENSE.md |
|||
├── Third Party Notices.md |
|||
├── QAReport.md |
|||
├── Editor |
|||
│ ├── Unity.[YourPackageName].Editor.asmdef |
|||
│ └── EditorExample.cs |
|||
├── Runtime |
|||
│ ├── Unity.[YourPackageName].asmdef |
|||
│ └── RuntimeExample.cs |
|||
├── Tests |
|||
│ ├── .tests.json |
|||
│ ├── Editor |
|||
│ │ ├── Unity.[YourPackageName].Editor.Tests.asmdef |
|||
│ │ └── EditorExampleTest.cs |
|||
│ └── Runtime |
|||
│ ├── Unity.[YourPackageName].Tests.asmdef |
|||
│ └── RuntimeExampleTest.cs |
|||
├── Samples |
|||
│ └── Example |
|||
│ ├── .sample.json |
|||
│ └── SampleExample.cs |
|||
└── Documentation~ |
|||
├── your-package-name.md |
|||
└── Images |
|||
``` |
|||
|
|||
## Develop your package |
|||
Package development works best within the Unity Editor. Here's how to set that up: |
|||
|
|||
1. Clone the `package-template` repository locally |
|||
|
|||
- In a console (or terminal) application, choose a place to clone the repository and perform the following : |
|||
``` |
|||
git clone https://gitlab.cds.internal.unity3d.com/upm-packages/upm-package-template.git |
|||
``` |
|||
# UI Widgets |
|||
1. Create a new repository for your package and clone to you desktop |
|||
|
|||
- On Gitlab, navigate to the [upm-packages](https://gitlab.cds.internal.unity3d.com/upm-packages), and make sure you have a sub-group for your feature area. If you don't have one, you can request a new sub-group in #devs-packman. |
|||
- Create a new repository with the name of your package (Example: `"com.unity.terrain-builder"`) |
|||
- In a console (or terminal) application, choose a place to clone the repository and perform the following : |
|||
``` |
|||
git clone https://gitlab.cds.internal.unity3d.com/upm-packages/[your-sub-group]/com.unity.[sub-group].[your-package-name] |
|||
``` |
|||
## Development |
|||
1. Start **Unity**, create a local empty project. |
|||
1. Start **Unity(2018.3 or above)**, create a local empty project. |
|||
|
|||
1. In a console (or terminal) application, go to the newly created project folder, then clone this repo into the packages directory. |
|||
1. In a console (or terminal) application, go to the newly created project folder, then clone your newly created package repository into the packages directory. |
|||
git clone https://gitlab.internal.unity3d.com/upm-packages/[sub-group]/[your-package-name].git com.unity.[sub-group].[your-package-name] |
|||
git clone https://gitlab.cds.internal.unity3d.com/upm-packages/ui-widgets/com.unity.uiwidgets.git com.unity.uiwidgets |
|||
__Note:__ Your directory name must be the name of your package (Example: `"com.unity.terrain-builder"`) |
|||
|
|||
1. Copy the locally cloned upm-package-template folder contents to your locally cloned package's folder. Be careful not to copy the upm-package-template `.git` folder over. |
|||
1. In a console (or terminal) application, push the template files you copied in your new package repository to it's remote |
|||
- Add them to your repository's list to version |
|||
```git add .``` |
|||
- Commit to your new package's remote master |
|||
```git commit``` |
|||
- Push to your new package's remote master |
|||
```git push``` |
|||
|
|||
1. ##### Fill in your package information |
|||
|
|||
Update the following required fields in file **package.json**: |
|||
- `"name"`: Package name, it should follow this naming convention: `"com.unity.[sub-group].[your-package-name]"` |
|||
(Example: `"com.unity.2d.animation"`, where `sub-group` should match the sub-group you selected in Gitlab) |
|||
- `"displayName"`: Package user friendly display name. (Example: `"Terrain Builder SDK"`). <br>__Note:__ Use a display name that will help users understand what your package is intended for. |
|||
- `"version"`: Package version `"X.Y.Z"`, your project **must** adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). |
|||
Follow this guideline: |
|||
- To introduce a new feature or bug fix, increment the minor version (X.**Y**.Z) |
|||
- To introduce a breaking API change, increment the major version (**X**.Y.Z) |
|||
- The patch version (X.Y.**Z**), is reserved for sustainable engineering use only. |
|||
- `"unity"`: Unity Version your package is compatible with. (Example: `"2018.1"`) |
|||
- `"description"`: This description appears in the Package Manager window when the user selects this package from the list. For best results, use this text to summarize what the package does and how it can benefit the user.<br>__Note:__ Special formatting characters are supported, including line breaks (`\n`) and unicode characters such as bullets (`\u25AA`).<br>For more information, see the [Writing Package docs](https://confluence.hq.unity3d.com/display/DOCS/Writing+Package+docs) page on Confluence. |
|||
|
|||
Update the following recommended fields in file **package.json**: |
|||
- `"dependencies"`: List of packages this package depends on. All dependencies will also be downloaded and loaded in a project with your package. Here's an example: |
|||
``` |
|||
dependencies: { |
|||
"com.unity.ads": "1.0.0" |
|||
"com.unity.analytics": "2.0.0" |
|||
} |
|||
``` |
|||
- `"keywords"`: List of words that will be indexed by the package manager search engine to facilitate discovery. |
|||
|
|||
Update the following field in file **Tests/.tests.json**: |
|||
- `"createSeparatePackage"`: If this is set to true, the CI will create an separate package for these tests. |
|||
|
|||
1. Restart Unity. For more information on embedded packages see [here](https://confluence.hq.unity3d.com/display/PAK/How+to+embed+a+package+in+your+project). |
|||
|
|||
1. If on 2018.1 - Enable package support in the editor (*Internal Feature*). From the **Project** window's right hang menu, enable `DEVELOPER`->`Show Packages in Project Window` (*only available in developer builds*). You should now see your package in the Project Window, along with all other available packages for your project. |
|||
|
|||
1. ##### Update **README.md** |
|||
|
|||
The README.md file should contain all pertinent information for developers using your package, such as: |
|||
* Prerequistes |
|||
* External tools or development libraries |
|||
* Required installed Software |
|||
* Command line examples to build, test, and run your package. |
|||
|
|||
1. ##### Rename and update **your-package-name.md** documentation file. |
|||
|
|||
Use this template to create preliminary, high-level documentation. This document is meant to introduce users to the features and sample files included in your package. |
|||
|
|||
1. ##### Rename and update assembly definition files. |
|||
|
|||
If your package contains Editor code, rename and modify [Editor/Unity.YourPackageName.Editor.asmdef](Editor/Unity.YourPackageName.Editor.asmdef). Otherwise, delete the Editor directory. |
|||
* Name **must** match your package name, suffixed by `.Editor` (i.e `Unity.[YourPackageName].Editor`) |
|||
* Assembly **must** reference `Unity.[YourPackageName]` (if you have any Runtime) |
|||
* Platforms **must** include `"Editor"` |
|||
|
|||
|
|||
If your package contains code that needs to be included in Unity runtime builds, rename and modify [Runtime/Unity.YourPackageName.asmdef](Runtime/Unity.YourPackageName.asmdef). Otherwise, delete the Runtime directory. |
|||
* Name **must** match your package name (i.e `Unity.[YourPackageName]`) |
|||
|
|||
If your package has Editor code, you **must** have Editor Tests. In that case, rename and modify [Tests/Editor/Unity.YourPackageName.Editor.Tests.asmdef](Tests/Editor/Unity.YourPackageName.Editor.Tests.asmdef). |
|||
* Name **must** match your package name, suffixed by `.Editor.Tests` (i.e `Unity.[YourPackageName].Editor.Tests`) |
|||
* Assembly **must** reference `Unity.[YourPackageName].Editor` and `Unity.[YourPackageName]` (if you have any Runtime) |
|||
* Platforms **must** include `"Editor"` |
|||
* Optional Unity references **must** include `"TestAssemblies"` to allow your Editor Tests to show up in the Test Runner/run on Katana when your package is listed in project manifest `testables` |
|||
|
|||
If your package has Runtime code, you **must** have Playmode Tests. In that case, rename and modify [Tests/Runtime/Unity.YourPackageName.Tests.asmdef](Tests/Runtime/Unity.YourPackageName.Tests.asmdef). |
|||
* Name **must** match your package name, suffixed by `.Tests` (i.e `Unity.[YourPackageName].Tests`) |
|||
* Assembly **must** reference `Unity.[YourPackageName]` |
|||
* Optional Unity references **must** include `"TestAssemblies"` to allow your Playmode Tests to show up in the Test Runner/run on Katana when your package is listed in project manifest `testables` |
|||
|
|||
> |
|||
> The reason for choosing such name schema is to ensure that the name of the assembly built based on *assembly definition file* (_a.k.a .asmdef_) will follow the .Net [Framework Design Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/index) |
|||
|
|||
1. ##### Document your package. |
|||
|
|||
**Document your public APIs** |
|||
* All public APIs need to be documented with XmlDoc. If you don't need an API to be accessed by clients, mark it as internal instead. |
|||
* API documentation is generated from [XmlDoc tags](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments) included with all public APIs found in the package. See [Editor/EditorExample.cs](Editor/EditorExample.cs) for an example. |
|||
|
|||
**Document your features** |
|||
* All packages that expose UI in the editor or runtime features should use the documentation template in [Documentation/your-package-name.md](Documentation/your-package-name.md). |
|||
|
|||
**Documentation flow** |
|||
* Documentation needs to be ready when a publish request is sent to Release Management, as they will ask the documentation team to review it. |
|||
* The package will remain in `preview` mode until the final documentation is completed. Users will have access to the developer-generated documentation only in preview packages. |
|||
* When the documentation is completed, the documentation team will update the package git repo with the updates and they will publish it on the web. |
|||
* The package's development team will then need to submit a new package version with updated docs. |
|||
* The starting page in the user manual that links to package documentation is [Here](http://docs.hq.unity3d.com/2018.1/Documentation/Manual/PackagesList.html). |
|||
* The `Documentation~` folder is suffixed with `~` so that its content does not get loaded in the editor, which is the recommended behavior. If this is problematic, you can still name it `Documentation` and all tools will still work correctly. `.Documentation` is also supported. |
|||
|
|||
**Test your documentation locally** |
|||
As you are developing your documentation, you can see what your documentation will look like by using the [DocTools extension](https://gitlab.internal.unity3d.com/upm-packages/package-ux/package-manager-doctools) (optional). |
|||
Once the DocTools package is installed, it will add a `Generate Documentation` button in the Package Manager UI's details of your installed packages. To install the extension, follow these steps: |
|||
|
|||
1. Make sure you have `Package Manager UI v1.9.6` or above. |
|||
1. Your project manifest will need to point to a staging registry for this, which you can do by adding this line to it: `"registry": "https://staging-packages.unity.com"` |
|||
1. Install `Package Manager DocTools v1.0.0-preview.6` or above from the `Package Manager UI` (in the `All Packages` section). |
|||
1. After installation, you will see a `Generate Documentation` button which will generate the documentation locally, and open a web browser to a locally served version of your documentation so you can preview it. |
|||
1. (optional) If your package documentation contains multiple `.md` files for the user manual, see [this page](https://docs.unity3d.com/Packages/com.unity.package-manager-doctools@1.0/manual/index.html#table-of-content) to add a table of content to your documentation. |
|||
|
|||
The DocTools extension is still in preview, if you come across arguable results, please discuss them on #docs-packman. |
|||
|
|||
1. ##### Add samples to your package (code & assets). |
|||
If your package contains a sample, rename the `Samples/Example` folder, and update the `.sample.json` file in it. |
|||
|
|||
In the case where your package contains multiple samples, you can make a copy of the `Samples/Example` folder for each sample, and update the `.sample.json` file accordingly. |
|||
|
|||
Similar to `.tests.json` file, there is a `"createSeparatePackage"` field in `.sample.json`.If set to true, the CI will create an separate package for the sample.. |
|||
|
|||
Delete the `Samples` folder altogether if your package does not need samples. |
|||
|
|||
As of Unity release 2019.1, the /Samples directory of a package will be recognized by the package manager. Samples will not be imported to Unity when the package is added to a project, but will instead be offered to users of the package as an optional import, which can be added to their "/Assets" directory through a UI option. |
|||
|
|||
1. ##### Validate your package. |
|||
|
|||
**Validate your package using the Validation Suite** |
|||
Before you publish your package, you need to make sure that it passes all the necessary validation checks by using the [Package Validation Suite extension](https://gitlab.internal.unity3d.com/upm-packages/package-ux/package-validation-suite) (required). |
|||
Once the Validation Suite package is installed, it will add a `Validate` button in the Package Manager UI's details of your installed packages. To install the extension, follow these steps: |
|||
|
|||
1. Make sure you have `Package Manager UI v1.9.6` or above. |
|||
1. Your project manifest will need to point to a staging registry for this, which you can do by adding this line to it: `"registry": "https://staging-packages.unity.com"` |
|||
1. Install `Package Validation Suite v0.4.0-preview.2` or above from the `Package Manager UI` in the `All Packages` section. If you can't find it there, try turning on `Show preview packages` in the `Advanced` menu. |
|||
1. After installation, you will see a `Validate` button show up in the Package Manager UI, which, when pressed, will run a series of tests and expose a `See Results` button for additional explanation. |
|||
1. If it succeeds, you will see a green bar with a `Success` message. |
|||
1. If it fails, you will see a red bar with a `Failed` message. |
|||
|
|||
The validation suite is still in preview, if you come across arguable results, please discuss them on #release-management. |
|||
|
|||
1. ##### Design Guidelines. |
|||
|
|||
1. You should follow these design guideline when creating your package |
|||
1. [Package design guidelines](https://confluence.hq.unity3d.com/display/UX/Packages) |
|||
1. [Unity design checklist](https://unitytech.github.io/unityeditor-hig/topics/checklist.html) |
|||
|
|||
1. The namespace for code in the asmdef **must** match the asmdef name, except the initial `Unity`, which should be replaced with `UnityEngine` or `UnityEditor`: |
|||
1. Runtime codeWe should only use the `Unity` namespace for code that has no dependency on anything in `UnityEngine` or `UnityEditor` and instead uses `ECS` and other `Unity`-namespace systems. |
|||
|
|||
1. ##### Add tests to your package. |
|||
|
|||
**Editor tests** |
|||
* Write all your Editor Tests in `Tests/Editor` |
|||
* If your tests require access to internal methods, add an `AssemblyInfo.cs` file to your `Editor` code and use `[assembly: InternalsVisibleTo("Unity.[YourPackageName].Editor.Tests")]` |
|||
|
|||
**Playmode Tests** |
|||
* Write all your Playmode Tests in `Tests/Runtime`. |
|||
* If your tests require access to internal methods, add an `AssemblyInfo.cs` file to your `Runtime` code and use `[assembly: InternalsVisibleTo("Unity.[YourPackageName].RuntimeTests")]` |
|||
|
|||
1. ##### Update **CHANGELOG.md**. |
|||
|
|||
Every new feature or bug fix should have a trace in this file. For more details on the chosen changelog format, see [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). |
|||
|
|||
## Create a Pre-Release Package |
|||
Pre-Release Packages are a great way of getting your features in front of Unity Developers in order to get early feedback on functionality and UI designs. Pre-Release packages need to go through the publishing to production flow, as would any other package, but with diminished requirements. Here are the supported Pre-Release tags (to be used in package.json,`version` field), along with the requirements for each one: |
|||
|
|||
**Preview** - ex: `"version" : "1.2.0-preview"` |
|||
* Expected Package structure respected |
|||
* Package loads in Unity Editor without errors |
|||
* License file present - With third party notices file if necessary |
|||
* Test coverage is good - Optional but preferred |
|||
* Public APIs documented, minimal feature docs exists- Optional but preferred |
|||
|
|||
## Register your package |
|||
|
|||
If you think you are working on a feature that is a good package candidate, please take a minute to fill-in this form: https://docs.google.com/forms/d/e/1FAIpQLSedxgDcIyf1oPyhWegp5FBvMm63MGAopeJhHDT5bU_BkFPNIQ/viewform?usp=sf_link. |
|||
|
|||
Working with the board of dev directors and with product management, we will schedule the entry of the candidates in the ecosystem, based on technical challenges and on our feature roadmap. |
|||
Don’t hesitate to reach out and join us on **#devs-packman** on Slack. |
|||
|
|||
## Share your package |
|||
|
|||
If you want to share your project with other developers, the steps are similar to what's presented above. On the other developer's machine: |
|||
|
|||
1. Start **Unity**, create a local empty project. |
|||
|
|||
1. Launch console (or terminal) application, go to the newly created project folder, then clone your repository in the packages directory |
|||
|
|||
```none |
|||
cd <YourProjectPath>/Packages |
|||
git clone https://gitlab.internal.unity3d.com/upm-packages/[sub-group]/[your-package-name].git com.unity.[sub-group].[your-package-name] |
|||
``` |
|||
__Note:__ Your directory name must be the name of your package (Example: `"com.unity.terrain-builder"`) |
|||
|
|||
## Make sure your package meets all legal requirements |
|||
|
|||
All packages are *required* to COMPLETE AND SUBMIT [THIS FORM](https://docs.google.com/forms/d/e/1FAIpQLSe3H6PARLPIkWVjdB_zMvuIuIVtrqNiGlEt1yshkMCmCMirvA/viewform) to receive approval. It is a simple, streamlined form that tells legal if there are any potential issues that need to be addressed prior to publication. |
|||
|
|||
##### Update **Third Party Notices.md** |
|||
|
|||
1. If your package has third-party elements and its licenses are approved, then all the licenses must be added to the `Third Party Notices.md` file. Simply duplicate the `Component Name/License Type/Provide License Details` section if you have more then one licenes. |
|||
|
|||
a. Concerning `[Provide License Details]` in the `Third Party Notices.md`, a URL can work as long as it actually points to the reproduced license and the copyright information _(if applicable)_. |
|||
|
|||
1. If your package does not have third party elements, you can remove the `Third Party Notices.md` file from your package. |
|||
|
|||
## Preparing your package for Staging |
|||
|
|||
Before publishing your package to production, you must send your package on the Package Manager's **staging** repository. The staging repository is monitored by QA and release management, and is where package validation will take place before it is accepted in production. |
|||
## *** IMPORTANT: The staging repository is publicly accessible, do not publish any packages with sensitive material you aren't ready to share with the public *** |
|||
|
|||
|
|||
1. Publishing your changes to the package manager's **staging** repository happens from Gitlab. To do so, simply setup your project's Continuous integration, which will be triggered by "Tags" on your branches. |
|||
* Join the **#devs-packman** channel on Slack, and request a staging **USERNAME** and **API_KEY**. |
|||
* In Gitlab, under the **Settings-> CI/CD -> Secret Variables** section, setup the following 2 project variables: |
|||
* API_KEY = [your API KEY] |
|||
* USER_NAME = [your USER NAME@unity] |
|||
* You're almost done! To publish a version of your package, make sure all your changes are checked into Gitlab, then create a new tag to reflect the version you are publishing (ex. "v1.2.2"), **the tag will trigger a publish to Staging**. You can view progress you the publish request by switch over to the "CI / CD" part of your project. |
|||
|
|||
1. Do it yourself CI |
|||
|
|||
If you are using your own CI, it is still recommended that you use the `build.sh` wrapper script that comes with the starter kit, as it handle the installation of the actual CI build scripts for you. |
|||
|
|||
Instead of calling `npm pack` and `npm publish` in the package root folder in your CI, use |
|||
``` |
|||
./build.sh package-ci pack --git-head $CI_COMMIT_SHA --git-url $CI_REPOSITORY_URL |
|||
``` |
|||
and |
|||
``` |
|||
./build.sh package-ci publish --git-head $CI_COMMIT_SHA --git-url $CI_REPOSITORY_URL |
|||
``` |
|||
respectively. |
|||
|
|||
1. Test your package locally |
|||
|
|||
Now that your package is published on the package manager's **staging** repository, you can test your package in the editor by creating a new project, and editing the project's `manifest.json` file to point to your staging package, as such: |
|||
``` |
|||
dependencies: { |
|||
"com.unity.[sub-group].[your-package-name]": "0.1.0" |
|||
}, |
|||
"registry": "https://staging-packages.unity.com" |
|||
``` |
|||
|
|||
## Get your package published to Production |
|||
|
|||
Packages are promoted to the **production** repository from **staging**, described above. Certain criteria must be met before submitting a request to promote a package to production. |
|||
[The list of criteria can be found here](https://docs.google.com/document/d/1TSnlSKJ6_h0C-CYO2LvV0fyGxJvH6OxC2-heyN8o-Gw/edit#heading=h.xxfb5jk2jda2) |
|||
|
|||
Once you feel comfortable that your package meets the list of Release Management Criteria, [Submit your package publishing request to Release Management](https://docs.google.com/forms/d/e/1FAIpQLSdSIRO6s6_gM-BxXbDtdzIej-Hhk-3n68xSyC2sM8tp7413mw/viewform). |
|||
|
|||
**Release management will validate your package content, and check that the editor/playmode tests are passed before promoting the package to production. You will receive a confirmation email once the package is in production.** |
|||
|
|||
**You're not done!** |
|||
At this point, your package is available on the cloud, 2 more steps are required to make your package discoverable in the editor: |
|||
|
|||
1. Contact the Package Manager team in #devs-packman to ask them to add your package to the list of discoverable package for the Unity Editor. All you need to provide is the package name (com.unity.[sub-group].[your-package-name]) |
|||
1. If your package is meant to ship with a release of the editor (Unity Recommended Packages), follow these steps: |
|||
* Modify the editor manifest ``[root]\External\PackageManager\Editor\Manifest.json`` to include your package in the list of dependencies. |
|||
* Submit one or more Test Project(s) in Ono, so that your new package can be tested in all ABVs moving forward. The following steps will create a test project that will run in ABVs, load your package into the project, and run all the tests found in your package. The better your test coverage, the more confident you'll be that your package works with trunk. |
|||
* Create a branch in Ono, based on the latest branch this package must be compatible with (trunk, or release branch) |
|||
* If your package contains **Editor Tests**: |
|||
* In ``[root]\Tests\Editor.Tests``, create a new EditorTest Project (for new packages use **YourPackageName**) or use an existing project (for new versions of existing package). |
|||
* A [skeleton of EditorTest Project can be found here](https://oc.unity3d.com/index.php/s/Cldvuy6NpxqYy8y). |
|||
* Modify the project’s manifest.json file to include the production version of the package (name@version). |
|||
* Your project's manifest.json file should contain the following line: ``"testables" : [ "com.unity.[sub-group].[your-package-name]" ]`` |
|||
* If your package contains **PlaymodeTests**: |
|||
* In ``[root]\Tests\PlaymodeTests``, create a new PlaymodeTest Project (for new packages use **YourPackageName**) or use an existing project (for new versions of existing package). |
|||
* Modify the project’s manifest.json file to include the staging version of the package (name@version). |
|||
* Your project's manifest.json file should contain the following line: ``"testables" : [ "com.unity.[sub-group].[your-package-name]" ]``. |
|||
* Commit your branch changes to Ono, and run all Windows & Mac Editor/PlayMode tests (not full ABV) in Katana. |
|||
* Once the tests are green on Katana, create your PR, add both `Latest Release Manager` and `Trunk Merge Queue` as reviewers. |
|||
|
|||
|
|||
## FAQ |
|||
|
|||
**What’s the difference between a preview package and a verified package?** |
|||
|
|||
A preview package is a great way to develop and get feedback on new features and functionality. Preview package can be created against any version of Unity 2018.1+, and can be made discoverable through the Package Manager UI by issuing a request in #devs-packman. Quality and release schedule is up to the package owner, although minimum bars are set in place to ensure the package contains the right licenses, documentation, and a comprehensive set of tests. |
|||
|
|||
Once a preview package has been in the field for 2-3 release cycles of the editor, that package can be considered for Verification. Verified packages are tested with a specific version of the editor, and offer our users a compatibility guarantee. Verified packages are the only packages that can be included in the set of templates we ship with the editor (Verified Templates). Code for these packages must follow core development guidelines, including code cutoff dates, and are tested in katana for continued compatibility. |
|||
|
|||
**What’s the difference between a core package and a default package?** |
|||
|
|||
A core package is a package that has its code included with the Editor’s core code. This is interesting for packages that plan to change enormously in parallel to editor APIs. By moving package code to the editor’s repo, both core API\functionality changes can be made along with required packages changes in the same PR. |
|||
https://docs.google.com/document/d/1CMoanjR3KAdew-6n39JdCFmHkTp1oshs3vkpejapf4Q/edit |
|||
|
|||
A default package is a verified packages that gets installed with every new project users create, regardless of the template they use. We should limit the number of default packages we support, as each default package adds to the project loading time. The list of default packages can be found in the editor manifest (https://ono.unity3d.com/unity/unity/files/de904b9ed9b44580ecd1e883f510daaa08182cc5/External/PackageManager/Editor/manifest.json). |
|||
|
|||
**What are the requirement for me to publish a preview package?** |
|||
|
|||
https://docs.google.com/document/d/1epGkAJRayJLN89_weA_-G5LFT_1uFifFZqBzAgvp_Zs/ |
|||
|
|||
|
|||
**What are the requirements for me to get my package verified for a version of unity?** |
|||
|
|||
https://docs.google.com/document/d/1oWC9XArVfkGMnqN9azR4hW4Pcd7-kQQw8Oy7ckP43JE/ |
|||
|
|||
**How is my verified package tested in Katana?** |
|||
|
|||
https://docs.google.com/document/d/1jwTh71ZGtB2vF0SsHEwivt2FunaJWMGDdQJTpYRj3EE/edit |
|||
|
|||
**How is my template tested in Katana?** |
|||
|
|||
https://docs.google.com/document/d/1jwTh71ZGtB2vF0SsHEwivt2FunaJWMGDdQJTpYRj3EE/edit |
|||
|
|||
**How do I add samples to my package?** |
|||
|
|||
https://docs.google.com/document/d/1rmxGh6Z9gtbQlGUKCsVBaR0RyHvzq_gsWoYs6sttzYA/edit#heading=h.fg1e3sz56048 |
|||
|
|||
**How can I add tests to my package?** |
|||
|
|||
There’s a “Tests” directory in the package starter kit. If you add editor and playmode tests in that directory, they will make up the list of tests for your package. |
|||
|
|||
**The tests in my package bloat my package too much, what are my options?** |
|||
|
|||
https://docs.google.com/document/d/19kKIGFetde5ES-gKXQp_P7bxQ9UgBnBUu58-y7c1rTA/edit |
|||
|
|||
**Can I automate my package publishing yet?** |
|||
|
|||
Not just yet, but we’re working on it. The first automated publishing we will enable is the push to production for preview packages. Basically, when your package passes validation (loads in the editor without error, the tests in the package pass, validation suite run success), the package will be pushed to production automatically. Other publishing flows will soon be available as well, here’s the full list of internal package publishing flows Unity will support. https://docs.google.com/document/d/1zdMzAtfi-vgM8NMPmwL40yinBeL3YImwTO5gSfGNCgs/edit |
|||
|
|||
**How do I get a template package started?** |
|||
|
|||
Start with the Project Template Starter Kit (you can request access in #devs-packman). |
|||
https://gitlab.internal.unity3d.com/upm-packages/project-templates/project-template-starter-kit |
|||
|
|||
**How do I get my package included in a template?** |
|||
|
|||
First and foremost, your package needs to be on the verified list of packages. Only verified packages can get added to templates we ship with the editor. Then reach out to the templates community in #devs-template to open discussions on adding your package to one or more of our existing templates. |
|||
|
|||
**How can I test my package locally, as a user would?** |
|||
|
|||
https://confluence.hq.unity3d.com/display/PAK/How+to+add+a+git+package+to+your+project |
|||
|
|||
**What tests are included by the validation suite?** |
|||
|
|||
https://docs.google.com/spreadsheets/d/1CdO7D0WSirbZhjnVsdJxJwOPK4UdUDxSRBIqwyjm70w/edit#gid=0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 554f0428d312c457e91dcab77ad9aa3c |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
{ |
|||
"displayName":"UIWidgetSample", |
|||
"description": "Sample usage of UI Wideget", |
|||
"createSeparatePackage": false |
|||
} |
|
|||
{ |
|||
"name": "UIWidgetSample", |
|||
"references": ["Unity.UIWidgets"], |
|||
"includePlatforms": [], |
|||
"excludePlatforms": [] |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f461a1d3753154b95a03ee91cfcbbbb7 |
|||
AssemblyDefinitionImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9f90b02b089a64284a0510a208167a74 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ade2732b79fb40cfacd288e4083d3a8e |
|||
timeCreated: 1545377495 |
|
|||
fileFormatVersion: 2 |
|||
guid: 073af4a3d604e42ea849ab8e20463604 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue