Search Unity

How to generate meta file by dll file

Discussion in 'Package Manager' started by Yijiankeji, Mar 27, 2020.

  1. Yijiankeji

    Yijiankeji

    Joined:
    Jul 27, 2019
    Posts:
    43
    Hello, in order to do code encapsulation, I used Unity asmdef file, and compiled the code into Dll files of Runtime and Editor. Then I retrieved the Dll files from the "Library / ScriptAssemblies" folder and put them into the corresponding Runtime and Editor respectively. The folder is finally uploaded to the Gitlab intranet server.
    When I added the git address in the UPM of new project, the Editor told me:
    Asset Packages / com.xxxx.xframework / Runtime / Unity.XFramework.dll has no meta file, but it's in an immutable folder. The asset will be ignored.

    That is, the Dll file generated by my method does not have a meta file. Is there any way to automatically generate this meta file.
    Because in the upm package we provide, Runtime and Editor should only put Dll files, not code.
     
    AskCarol likes this.
  2. AskCarol

    AskCarol

    Joined:
    Nov 12, 2019
    Posts:
    234
    Let me pass this on to the team and get back to you!
    Thanks :)
     
  3. Yijiankeji

    Yijiankeji

    Joined:
    Jul 27, 2019
    Posts:
    43
    Thx a lot
     
  4. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    549
    Hi @Yijiankeji,

    In order to get a metafile generated, either copy the generated DLL files in a regular Unity project (you might need to put one under an Editor folder), and just add the generated .meta files to your package. Alternatively, if you clone your package repo under
    <ProjectDir>/Packages/<PackageName>
    , it will be imported as a mutable package.

    For additional information, please refer to the Unity manual section about creating custom packages: https://docs.unity3d.com/Manual/CustomPackages.html
     
  5. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    I meet a similar issue today, to add .meta files to DLLs generated by CI. I ended up with copy those generated meta files to a special folder, then recover them during the CI.

    Well, it works, but I guess what I want is a simple CLI script to help generate meta files. So GUID is just a 32 digits UUID?
     
  6. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    549
    Hi @Favo-Yang,

    There are other properties beyond the GUID (though only that one needs to be unique per asset), so in order to protect you from subtle issues/implementation details, I would suggest that you don't craft the meta files yourself, but instead rely on Unity to do this. It can be automated by a small CLI script like you're thinking of: just launch Unity in batch mode against a fake empty project that contains your package in it (
    -batchmode -quit -projectpath <absolute-path-to-project>
    ), to make it import and generate the files with the proper format.
     
  7. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    @maximeb_unity, thanks for the quick reply. Yes, there're other fields and changed from time to time. I guess I'll need a very reliable way to acquire a Unity personal license on CI (GitHub actions). I will do some research later.