Search Unity

Double-clicking package.json for local package doesn't result in showing the package in the list

Discussion in 'Package Manager' started by tscizzlebg, Aug 13, 2019.

  1. tscizzlebg

    tscizzlebg

    Joined:
    Aug 9, 2019
    Posts:
    3
    Hello! First package so forgive me if the solution is obvious.

    I followed the instructions here: https://docs.unity3d.com/Manual/CustomPackages.html#LocalMe to create my own package that just has a couple script files that a bunch of my games will all use.

    Then I followed these instructions: https://docs.unity3d.com/Manual/upm-ui-local.html to now install that custom package in a little example project.

    I got to the point of going into the Package Manager, all the way to double-clicking the package.json, and the file browser closes but I don't see my custom package in the list in the Package Manager. I tried a few times, but am out of clues, so came here.

    Below is my upm.log file, since the forum said that would be appreciated. I looked in it and I didn't see anything promising, though. (I would have attached instead of copy-paste, but this site is saying the extension won't allow it to be uploaded.)

    {"level":"info","message":"Starting Server","timestamp":"2019-08-13T20:29:25.016Z"}
    {"level":"info","message":"Server started on port [51715]","timestamp":"2019-08-13T20:29:25.021Z"}
    {"level":"info","message":"Health Request received","timestamp":"2019-08-13T20:29:25.406Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:35:38.968Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:35:39.222Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:37:20.166Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:37:20.467Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:42:31.795Z"}
    {"level":"warn","message":"Failed to determine if package 'com.unity.formats.fbx@2.0.1-preview.3' is compatible with Unity version '2019.2.0f1': Error: '2018.3.2018.3.4f1' is not a valid Unity version","timestamp":"2019-08-13T20:42:32.090Z"}
     
  2. erick_unity

    erick_unity

    Unity Technologies

    Joined:
    Jan 4, 2017
    Posts:
    41
    hi @tscizzlebg, in your package.json file, the "unity" field needs to point to simplified version, such as "2018.3". Make sure that's the case, and if you still have issues, please share your package.json file, or checkout the package.json of one of Unity's existing packages as a point of compare.
     
    tscizzlebg likes this.
  3. tscizzlebg

    tscizzlebg

    Joined:
    Aug 9, 2019
    Posts:
    3
    Thanks! I added the "unity" field with version, the Package Manager didn't work still but I manually added the line "com.blah-blah.unity-game-template-package": "file:../../../UnityGameTemplatePackage" to my project's Packages/manifest.json and now I'm seeing new errors, which I can deal with now.

    For anyone else seeing this, this gist is helpful: https://gist.github.com/LotteMakesStuff/6e02e0ea303030517a071a1c81eb016e

    Appreciate your help! (And I'll let you know if I can't get past the new errors.)
     
  4. tscizzlebg

    tscizzlebg

    Joined:
    Aug 9, 2019
    Posts:
    3
    How does one add dependencies to a package? I.e. I have a few Unity projects, into which I know how to import packages with NuGet or import local packages as described in this thread above, but what about dependencies of that local package itself?

    For example, my local package I'm making (which my multiple Unity projects each want to use) depends on JSON.net and websocket-sharp. I can't open my package open in Unity and use the Unity Package Manager, because it's not a Unity project. It's just a package. There's a "dependencies" field in my package's package.json, but I don't know what strings go there to include these 3rd party libraries, JSON.NET and websocket-sharp.

    // EDIT:
    I can use NuGet to import the JSON.net and websocketsharp into my PROJECT, so the project can run using my custom package which needs those dependencies.
    I do NOT have it yet where my custom package is the one bringing those dependencies with it, i.e. so when I make another project and want to use my package again, that new project separately needs to make sure those dependencies are imported.

    Still hoping my custom package can automatically provide those dependencies itself, instead of hoping the project it's being imported into also imports those dependencies.
     
    Last edited: Aug 14, 2019