Version: 2021.1
Creating samples for packages
バージョン管理

パッケージマニフェスト

Unity はパッケージ マニフェストファイル (package.json) を使用して、特定のパッケージの特定のバージョンに関する情報を管理します。パッケージマニフェストは常にパッケージのルートにあり、登録名とバージョン番号などのパッケージに関する重要な情報が含まれています。また、ユーザーと通信するための有用な情報を定義します。例えば、UI に表示されるユーザーにわかりやすい表示名、パッケージの簡単な説明、パッケージと互換性のある Unity の最も古いバージョンなどが含まれます。

The package manifest uses the JSON (JavaScript Object Notation) syntax to describe what the package contains. The file’s format is similar to npm’s package.json format, but uses different semantics for some of its properties.

The Package Manager reads this manifest to find out what the package contains, how to unpack its contents, and what information to show the user in the Package Manager window. The manifest stores this information in a series of required, mandatory, and optional properties.

Required properties

These properties are required. If they are not present, either the registry refuses the package when it is published, or the Package Manager cannot fetch or load the package.

プロパティー JSON 型 説明
name 文字列 The officially registered package name. This name must conform to the Unity Package Manager naming convention, which uses reverse domain name notation. For more information about the naming convention, see Naming your package.

Note: This is a unique identifier, not the user-friendly name that appears in the list view on the Package Manager window.
version 文字列 パッケージのバージョン番号 (MAJOR.MINOR.PATCH)。

例えば、“3.2.1” は 3 番目のメジャーリリースの 2 番目のマイナーリリースで最初のパッチであることを示しています。

この値は セマンティックバージョニング に準拠する必要があります。詳しくは、バージョン管理を参照してください。

Mandatory properties

These properties are technically optional, and the Package Manager can still install them in a project even if they do not contain valid values or are missing. However, you should give values for these properties, to make your package easily discoverable and provide a better experience for users.

プロパティー JSON 型 説明
description 文字列 パッケージの簡単な説明。これは、Package Manager ウィンドウの詳細ビューに表示されるテキストです。すべての UTF–8 文字コードがサポートされます。つまり、改行 (\n) や箇条書き (\u25AA) などの特殊な形式の文字コードを使用できます。
displayName 文字列 Unity エディター (例えば、Project ブラウザー、Package Manager ウィンドウなど) に表示されるユーザーに分かりやすい名前。

例えば、Unity TimelineProBuilderIn App Purchasing
unity 文字列 Indicates the lowest Unity version the package is compatible with. If omitted, the package is considered compatible with all Unity versions.

The expected format is “<MAJOR>.<MINOR>” (for example, 2018.3). To point to a specific patch, use the unityRelease property as well.

Note: A package that is not compatible with Unity will not appear in the Package Manager window.

Optional properties

These properties are optional, meaning that you can omit them. However, if they are present, they must have a valid value.

プロパティー JSON 型 説明
author オブジェクト パッケージの作者。

このオブジェクトには、1 つの必須のフィールド (name) と 2 つのオプションのフィールド (emailurl)が含まれます。


{ "name" : "John Doe",
   "email" : "john.doe@example.com",
   "url" : "http://john.doe.example.com/"
}
changelogUrl 文字列 Custom location for this package’s changelog specified as a URL. For example:
"changelogUrl": "https://example.com/changelog.html"

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, it opens a file browser displaying the CHANGELOG.md file in the package cache.
- If the package is not installed, the Package Manager displays a warning that an offline changelog is not available.
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, it opens a file browser displaying the Documentation~ folder in the package cache.
- If the package is not installed, the Package Manager displays a warning that offline documentation is not available.
hideInEditor boolean Normally, the Package Manager hides most packages automatically (the implicit value is “true”), but you can set this property to “false” to make sure that your package and its assets are always visible.
keywords 文字列の配列 Package Manager の検索 API によって使用されるキーワードの配列。これは、ユーザーが関連するパッケージを見つけるのに役立ちます。
license 文字列 Identifier for an OSS license using the SPDX identifier format, or a string such as “See 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: 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, it opens a file browser displaying the LICENSE.md file in the package cache.
- If the package is not installed, the Package Manager displays a warning that offline license information is not available.
samples オブジェクトの配列 List of samples included in the package. Each sample contains a display name, a description, and the path to the sample folder starting at the Samples~ folder itself:

{
   "displayName": "<name-to-appear-in-the-UI>",
   "description": "<brief-description>",
   "path": "Samples~/<sample-subfolder>"
}

For more information, see Creating samples for packages.
type 文字列 Package Manager に追加情報を与える定数。

内部使用のために予約されています。
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 (for example, if it needs newly introduced APIs, or uses existing APIs that 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 unity property, this property has no effect.

A package that is not compatible with Unity does not appear in the Package Manager window.

パッケージマニフェストの例

{
  "name": "com.unity.example",
  "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.unity.some-package": "1.0.0",
    "com.unity.other-package": "2.0.0"
 },
 "keywords": [
    "keyword1",
    "keyword2",
    "keyword3"
  ],
  "author": {
    "name": "Unity",
    "email": "unity@example.com",
    "url": "https://www.unity3d.com"
  }
}


Creating samples for packages
バージョン管理