Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Meta Files for Custom Git Package?

Discussion in 'Package Manager' started by aaronchapin, Jul 6, 2020.

  1. aaronchapin

    aaronchapin

    Joined:
    Oct 19, 2018
    Posts:
    2
    I've created a small repo to try out distributing code using the package manager: https://github.com/achapin/quickref

    The basic structure was set up according to the documentation here: https://docs.unity3d.com/Manual/cus-layout.html. Since that documentation doesn't mention any other Unity-specific files or folders, I kept it as a standalone folder, not a Unity project.

    However, when I go into a target project, and add a reference to the package's master commit (https://github.com/achapin/quickref/commit/79cbb17c266a2484d7cbc3e4b7c9d3ceeab4652d), I get errors that all of the files are missing .meta files and the path is immutable and will be ignored. As a test, I created a new branch where the code files are part of a Unity project, and thus have generated meta files. When my test project targets that commit (https://github.com/achapin/quickref/commit/119daa6bde6e7fec22348d35ef0e24dc34f31feb) the code files are able to be loaded and referenced correctly, but there are still warnings for other files, like the package.json. What's also odd (see screenshot) is that even though the code files are loaded and usable, the package folder still appears to have no contents in the hierarchy. This is even after a full and partial reload.

    Is this expected/intended? I tried this test on Windows, with an account that has admin access (though neither the Unity Hub nor the editor were specifically launched as an administrator). Logs are attached.
     

    Attached Files:

  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    You must include .meta files into your repository. You can achieve that by
    1) create package at the root path of the repository (package.json at the root path)
    2) create a dummy Unity project and move your checkout to the Packages folder. Unity will treat your package mutable (in-development) and generate meta files for you.

    Commit to git and create another dummy project to test your package via Git URL.