Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How exactly is a package created from inside the sample project?

Discussion in 'Package Manager' started by surreality_games, Nov 16, 2022.

  1. surreality_games

    surreality_games

    Joined:
    Jun 2, 2022
    Posts:
    3
    Hi Everyone!

    Sorry if this has been asked already a million times (I've spent a good deal of searching and i can't seem to find anything specific enough to make sense of it).

    Essentially, I'm trying to upload a system that also contains a sample.

    The hierarchy i thought I was supposed to do was:
    -ROOT
    - Documentation
    - Editor
    - Runtime
    - Samples~
    - Tests​

    The sample contains an entire Unity Project, including some other packages ( input system, Cinemachine, etc).

    However, It seems that i've misunderstood the proper hierarchy. I want the core system to be importable without the sample project, But I cannot upload the asset without the project being the root folder. What exactly am I misunderstanding about this process? Where would I normally be uploading it from if I don't want to include the entire Sample Project?

    Images:
    Root Folder:


    Sample Folder:



    Thank you for any feedback!

    Robin
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,191
    The Samples~ folder isn't supposed to contain an entire Unity project. You should only add custom scenes and other assets you need to provide to make a working example/demo.

    When I create a package for my own projects this is what I do:

    • create empty folder "MyPackage" and set up the package in there (ie add a package.json file at a minimum)
    • create a Unity project "MyProject"
    • in that or any other project, use Package Manager "add from disk" and select the folder of my package
    • work in the project and the package at the same time as needed
     
    maximeb_unity likes this.
  3. surreality_games

    surreality_games

    Joined:
    Jun 2, 2022
    Posts:
    3
    Hi and thanks for replying!

    Does this mean that the Project I create to upload the actual package is kind of irrelevant?

    Also regarding dependencies... The Demo uses the new input system, Cinemachine, etc, but the tool does not. Do you know if there is a way to specify that with the "Does this package have Asset Store package dependencies?" question?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,191
    Yep.

    These dependencies would still need to be specified in package.json I believe, however ...

    ... does this mean you are preparing a package for upload to the Asset Store? If so, you cannot do that with a Package Manager package, it's got to be a .unitypackage kind of package because the UAS is still relying on the old system unfortunately.

    Regardless, if you don't want the samples to add more dependencies to the package, you'd have to split the samples into another package (be it Package Manager or .unitypackage). I believe UAS allows additional .unitypackage files inside the asset, for demos/samples.
     
  5. surreality_games

    surreality_games

    Joined:
    Jun 2, 2022
    Posts:
    3
    Yes- I've used the Asset Store Tools to upload a version of it, and while the internal tool asked if I had any dependencies, It appears that the web UI is also asking me that question.

    Given that it's just Cinemachine and the Input System, should I just rewrite the demo to not rely on them? It's just an FPS controller - It seems like it'd make more sense to do that to reduce the dependencies.

    Thanks again for your feedback!

    Robin