Skip to content

JoanofArcGames/com.joanofarcgames.package-constructor

Repository files navigation

Important statement

This package is by no means stable or production-ready

It might break under unpredictable circumstances. It might not contain features you expect. It might contain bugs.
If you encounter any issues, if you have features you'd want included, if you've found a bug, please, file a GitHub issue.

Overview

This package is a full-featured solution to automate creation of new Unity packages. It carefully follows recommended package layout. The goal is to reduce friction and number of boilerplate-kind of actions when creating new Unity packages. The constructor does nothing more than is outlined in Unity's instructions on creating custom packages. It just does it automatically, saving your valuable time.

Supported platforms

As I don't have necessary capabilities to thoroughly test package on various OS and setups, I encourage anyone who has tried it and it worked for them to report it. There's nothing platform-specific or unity-version-specific in what this package does, so it should work, but I cannot guarantee it.

Unity

Package has been tested and confirmed to work on Unity 2022.2.18f1 and 2022.3.0f1. It should work on any Unity version that supports Unity Package Manager GUI (2018.1+).

Operating system

Package has been tested and confirmed to work on Windows 11 22H2. It should work on any OS.

Installation

Brief

Install via git url:
https://github.com/JoanofArcGames/com.joanofarcgames.package-constructor.git

Detailed

  1. Open Unity Package Manager
  2. In top-left corner, click +
  3. Choose Add package from git URL...
  4. Paste git url of this package:
    https://github.com/JoanofArcGames/com.joanofarcgames.package-constructor.git
  5. Click Add / press Enter

How to use

  • In /Assets/ directory, right clickcreateJAGConstruction config
  • Set up the config. Use the guide below for reference
  • Click Construct button at the bottom of config file's inspector
    • If config contains invalid data, errors will be reported in Console window, and construction will be aborted

Note: to maximize time you save by using this package, it is recommended to keep all your packages in a single project with Package Constructor installed and configured.

Config guide

Package information, Dependencies, Keywords and Author sections

This is what goes to your package.json file, which is the core of every Unity package. It contains all valuable information about the package, such as name, version, description, dependencies, links to changelog, documentation, etc.
Read more in Unity Manual

Package information

  • Version – This is current version of your package. It must comply with semantic versioning pattern.

  • Company Name and Package Name – Name of your company and your package. They must be PascalCase.

    • Note: you can specify additional nested namespaces divided with . in Package Name.
    • Note: Company Name and Package Name will get automatically combined and converted into reverse domain name notation, such as com.unity.entities or com.unity.burst.
      For example, MyAwesomeCompany and MyAwesomePackage will result in com.my-awesome-company.my-awesome-package.
      See Unity Manual for package naming conventions.

  • Display Name – User-friendly name to appear in Unity editor, such as Entities or Burst.

  • Description – A brief description of the package. This is the text that appears in the details view of the Package Manager window. This field supports UTF–8 character codes.

  • Unity Version and Unity Release – The lowest Unity version compatible with the package.
    Unity Version is <MAJOR>.<MINOR>, such as 2022.3.
    Unity Release is <UPDATE>.<RELEASE>, such as 0f1.

    • Note: if these fields are omitted, Package Manager considers your package compatible with all Unity versions.
    • Note: if Unity Version is omitted, Unity Release will make no effect.
    • Note: a package that isn't compatible with Unity doesn't appear in Package Manager window.

  • Documentation URL, Changelog URL and Licenses URL – You can specify links to web pages containing related information about you package.

  • License – Identifier for an OSS license using the SPDX identifier format, or a string such as See LICENSE.md file.

  • Hide In Editor – Whether or not to hide your package in Editor. Most packages have this set to true.

Dependencies

Specify packages that your package depends on. Use official names in reverse domain name notation and semver versions.

Keywords

Keywords are used by the Package Manager search APIs. This helps users find relevant packages.

Author

Specify information related to either you personally, or your company.
Note: if you fill either email or url, the name field must be filled as well.

Directories

/Editor/

Put your code/assets that are specific to Unity editor in this directory.
Assembly definition which is constructed by default is configured to only include Editor as platform, meaning code you put there will not ship with built game. For example, Package Constructor's files are in this directory.

/Runtime/

Put your code/assets that are supposed to work anywhere besides Unity editor in this directory.

/Tests/Editor/ and /Tests/Runtime/

Tests for code in /Editor/ and /Runtime/ directories, correspondingly.
Note: to be able to run tests, com.unity.test-framework has to be installed in your project.
See Unity Manual for details.

/Samples~/

Directory to include samples, if any. See Unity Manual for details.

/Documentation~/

Most packages require some form of documentation. See Unity Manual for details.

Markdown files

README.md

This is where you write overview of your package, installation instructions, notes, screenshots, etc. For example, this text is part of a README file.
Markdown syntax cheat sheet
Examples of readme files

CHANGELOG.md

This is version history of your package.
Your git log is not a changelog
Keep a changelog

LICENSE.md

This is where you put your license in form of plain text or a link to appropriate web page.
Read about software licensing
SPDX License List
Meeting legal requirements

Third Party Notices.md

In case your package is using third-party libraries or assets of any kind, you might have to include their licenses.
Read more about third party notices in Unity Manual

Miscellaneous

Include template documentation

This option is available only if you have selected to include /Documentation~/ directory.
Provides you with a template documentation file which complies with Unity's guidelines.

Include blank scripts

Generates a blank .cs script alongside each .asmdef file. Otherwise Unity will complain in console that you have assemblies with no scripts associated.

Enable logging

Display informational messages in console regarding construction. This doesn't affect config validation errors.

Developer notes

  • Currently, I am unaware of how to disable warnings regarding asmdefs with no scripts associated, other than including placeholder scripts. If you have ideas, communicate them to me.
  • Currently, constructor doesn't add entry for samples into package.json. It doesn't make sense to do so, because when you just start your package, you don't have any samples. Probably I will add functionality to auto-generate entries for samples and inject them to existing package.json.