Edit the package manifest
Edit the package manifest to customize the package's details.
阅读时间3 分钟最后更新于 22 天前
The package manifest () defines the metadata for a Unity Package Manager (UPM) package, including its registered name, version, dependencies, Unity Editor compatibility, and other configuration details. The Unity Editor uses this file to identify, load, and manage the package within the project.
package.jsonYou can view or edit the package manifest depending on the context:
- View the contents of the package manifest for UPM packages you added to your project from a registry, as a tarball, or from a Git URL.
- Edit the contents of the package manifest for packages you're developing or customizing.
View the package manifest
For all packages, including immutable packages, you can view most of the package manifest's properties directly in the Unity Editor:
-
Open the Package Manager window.
-
Select a package from the list panel.
-
Use one of the following methods to access thewindow:Inspector
?
- From the details panel, select Manage > Open Manifest.
- Manually open or go to the Inspector window.
The Inspector window displays information about the package, which it reads from the package manifest file ().
package.jsonTo view all fields, including ones not shown in the Inspector window, open the file with one of the following methods:
package.json- From the details panel, select Manage > Open Manifest Externally, to open in the script editor defined in Preferences > External Tools.
package.json - Locate the manifest file manually and open it in a script editor.
Locate the manifest file
You can locate the file to view the complete contents of the package manifest. If the package is mutable, you can also edit the file.
package.jsonYou can use several methods to locate the manifest file.
Locate the manifest file using the Package Manager window
- Open the Package Manager window.
- Select a package from the list panel.
- From the details panel, select Locate. Focus shifts to the Project window, with the package manifest file () highlighted.
package.json - To open the package manifest file, right-click and select Open. You can also select Show in Explorer (Windows) or Reveal in Finder (macOS), then open the file manually.
package.json
Locate the manifest file manually
- Open your operating system's file management application.
- Go to the folder for your Unity project or the folder where you're developing a local package.
- If you're in the Unity project folder, open the subfolder, then go to your package's subfolder
Packages - Open the file with your preferred script editor.
package.json
With the file open, refer to the package manifest reference to identify the different fields and their usage.
package.jsonEdit the manifest file for mutable packages
If you're developing a UPM package or customizing a registry package you copied into your project, follow these steps when you need to make changes to the manifest file.
You can use several methods to edit the manifest file.
Edit the manifest file within the Unity Editor
-
Open the Package Manager window.
-
Select your package from the list panel.
-
From the details panel, select the Manage dropdown button and select Edit Manifest.
-
Make your changes while referring to the package manifest reference.
-
Select Apply to save your changes.
If fields you need to edit aren't available in the Inspector window, use the manual method for editing the manifest file in a script editor.
Edit the manifest file in a script editor
- Open the Package Manager window.
- Select your package from the list panel.
- From the details panel, select the Manage dropdown button and select Edit Manifest Externally. The file opens in the script editor defined in Preferences > External Tools.
package.json - Make your changes while referring to the package manifest reference.
- Save the file.