Unity はパッケージ マニフェストファイル (package.json
) を使用して、特定のパッケージの特定のバージョンに関する情報を管理します。パッケージマニフェストは常にパッケージのルートにあり、登録名とバージョン番号などのパッケージに関する重要な情報を保持しています。
パッケージマニフェストは、以下のようなユーザーに伝えるべき有用な情報も定義されています。
The package manifest uses JSON (JavaScript Object Notation) syntax to describe what’s inside the package. The file’s format is similar to npm’s package.json
format, but uses different semantics for some of its properties. Refer to the example for a sample package manifest file.
The Package Manager reads this manifest to find out the package’s contents, how to unpack its contents, and what information to display in the Package Manager window. The manifest stores this information in a series of required, recommended, and optional properties.
これらのプロパティが存在しない場合は、公開するときにレジストリがパッケージを拒否するか、Package Manager がパッケージを見つけたりロードすることができません。
プロパティ | JSON 型 | 説明 |
---|---|---|
name | 文字列 | A unique identifier that conforms to the Unity Package Manager naming convention, which uses reverse domain name notation. For more information about the naming convention, refer to Naming your package. Note: The name identifier is different than the user-friendly display name that appears in the list panel in the Package Manager window. |
version | 文字列 | The package version number, which uses the format "major.minor.patch" . For example, "3.2.1" indicates that this is the 3rd major release, the 2nd minor release, and the 1st patch. This value must respect Semantic Versioning. For more information, refer to Versioning. |
The Package Manager can install packages in a project even if the recommended properties are missing or have invalid values.
However, the recommended best practice is to assign values for these properties to make sure that your package is discoverable and to offer a better experience for users.
プロパティ | JSON 型 | 説明 |
---|---|---|
description | 文字列 | A brief description of the package. This is the text that appears in the details panel of the Package Manager window. This field supports UTF–8 character codes. This means that you can use special formatting character codes, such as line breaks (\n ) and bullets (\u25AA ). |
displayName | 文字列 | A user-friendly name that appears in the Unity Editor (for example, in the Project window, the Package Manager window, etc.). Examples of displayName values are Unity Timeline, ProBuilder, and In App Purchasing. |
unity | 文字列 | Indicates the lowest Unity version the package is compatible with. If omitted, the Package Manager considers the package compatible with all Unity versions. The expected format is "major.minor" (for example, "2018.3" ). To point to a specific patch, also include the unityRelease property, described in Optional properties.Note: A package that isn’t compatible with Unity doesn’t appear in the Package Manager window. |
これらのプロパティは任意であり、省略することができます。ただし、設定する場合は、有効な値である必要があります。
プロパティ | JSON 型 | 説明 |
---|---|---|
author | オブジェクトまたは文字列 | パッケージの作者。 このプロパティには、name という必須フィールドが 1 つと、emailとurl という任意のフィールドが 2 つあります。 これらのフィールドは、JSON オブジェクトとして指定することも、author をキーとする 1 つの文字列にまとめることもできます。 オブジェクトの例: { "name" : "John Doe", "email" : "john.doe@example.com", "url" : "http://john.doe.example.com/" } 文字列の例: "John Doe <john.doe@example.com> (http://john.doe.example.com/)"
|
changelogUrl | 文字列 | URL で指定したパッケージの変更ログのカスタムの保存場所。以下はその例。"changelogUrl":"https://example.com/changelog.html" ノート: Package Manager が URL の場所に到達できない場合 (ネットワークの問題など) は、以下を行います。 - パッケージがインストールされている場合、ファイルブラウザーを開き、パッケージキャッシュ内の CHANGELOG.md ファイルを表示します。- パッケージがインストールされていない場合、Package Manager はオフラインの変更ログが利用できないという警告を表示します。 |
dependencies | オブジェクト | パッケージの依存関係のマップ。キーはパッケージ名で、値は特定のバージョンです。それらは、このパッケージが依存する他のパッケージを識別します。 ノート: Package Manager は範囲の構文をサポートせず、 SemVer バージョンのみをサポートします。 |
documentationUrl | 文字列 | Custom location for this package’s documentation, specified as a URL. For example:"documentationUrl": "https://example.com/" Note: When the Package Manager can’t reach the URL location (for example, if there is a network issue), it does the following: - If the package is installed, the Package Manager opens a file browser displaying the Documentation~ folder in the package cache. - If the package isn’t installed, the Package Manager displays a warning that offline documentation isn’t available. |
hideInEditor | ブーリアン | By default, the Project window hides package’s assets and omits them from the results when you use the Object Picker in the Inspector window. Set this property to "false" to make sure that this package’s assets are always visible. |
keywords | 文字列の配列 | Package Manager の検索 API によって使用されるキーワードの配列。これは、ユーザーが関連するパッケージを見つけるのに役立ちます。 |
license | 文字列 | Identifier for an OSS license using the SPDX identifier format, or a string such as “Refer to LICENSE.md file”. Note: If you omit this property in your package manifest, your package must contain a LICENSE.md file. |
licensesUrl | 文字列 | Custom location for this package’s license information, specified as a URL. For example:"licensesUrl": "https://example.com/licensing.html" Note: If the Package Manager can’t reach the URL location (for example, if there is a network issue), it does the following: - If the package is installed, it opens a file browser displaying the LICENSE.md file in the package cache. - If the package isn’t installed, the Package Manager displays a warning that offline license information isn’t available. |
samples | オブジェクトの配列 | List of samples included in the package. Each sample has a display name, a description, and the path to the sample folder starting at the Samples~ folder:{ "displayName": "<name-to-appear-in-the-UI>", "description": "<brief-description>", "path": "Samples~/<sample-subfolder>" } For more information, refer to Creating samples for packages. |
type | 文字列 | Reserved for internal use. |
unityRelease | 文字列 | Part of a Unity version indicating the specific release of Unity that the package is compatible with. You can use this property when an updated package requires changes made during the Unity alpha/beta development cycle. This might be the case if the package needs newly introduced APIs, or uses existing APIs that have changed in a non-backward-compatible way without API Updater rules. The expected format is "<update><release> (for example, "0b4" ). Note: If you omit the recommended unity property, this property has no effect. A package that isn’t compatible with Unity doesn’t appear in the Package Manager window. |
{
"name": "com.[company-name].[package-name]",
"version": "1.2.3",
"displayName": "Package Example",
"description": "This is an example package",
"unity": "2019.1",
"unityRelease": "0b5",
"documentationUrl": "https://example.com/",
"changelogUrl": "https://example.com/changelog.html",
"licensesUrl": "https://example.com/licensing.html",
"dependencies": {
"com.[company-name].some-package": "1.0.0",
"com.[company-name].other-package": "2.0.0"
},
"keywords": [
"keyword1",
"keyword2",
"keyword3"
],
"author": {
"name": "Unity",
"email": "unity@example.com",
"url": "https://www.unity3d.com"
}
}