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

Package Sample Workflow

Discussion in 'Package Manager' started by hugeandy, Aug 27, 2019.

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Hey all,

    Have just been working on some samples in a few of the packages I have. I've followed the structure outlined here:
    https://forum.unity.com/threads/samples-in-packages-manual-setup.623080/#post-4694132

    The problem I have is that any script files that I create in the packages Samples~ folder are not included in the C# VS project (they are listed as Miscellaneous Files in VS and I have to manually add them to the project, which I have to redo every time I create a new script via Unity) and therefore no intellisense etc. It is only when I import them using the package manager UI that the files are imported into the Assets folder, and then they have all the necessary references.

    For the time being, is the suggested workflow:
    Create an empty sample in the package Samples~ folder
    Import it using Package Manager UI
    Edit it until done
    Copy files back into the package Samples~ folder

    Or is there something that I'm missing?

    Cheers,
    Andy
     
  2. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Also, using this workflow and editing the sample files once they have already been imported into the Assets samples folder, the recompile time is noticeably extra long, even in an almost empty project.
     
  3. BorisMongeau

    BorisMongeau

    Unity Technologies

    Joined:
    Feb 24, 2017
    Posts:
    58
    Hi,

    We are currently working on a way to ease packages creation and it will give tooling around these problems that will rename folders before publishing packages. Unfortunately, until then it needs to be a manual step. Your workflow looks ok, you could just create a Sample folder in your package and simply add the ~ just before sharing it.
     
  4. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    If I do name the folder "Samples" instead of "Samples~", should the scripts be included in the C# project? As they are not (they are listed as Miscellaneous files in VS). Fine if not as it's all in development still, just asking to make sure it's not a bug!

    Cheers
     
  5. BorisMongeau

    BorisMongeau

    Unity Technologies

    Joined:
    Feb 24, 2017
    Posts:
    58
    I agree we should consider it as a bug if it's not part of the vs solution. I'll add a task to check it out.

    Thanks for the info
     
  6. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Nice one cheers!
     
  7. frank-ijsfontein

    frank-ijsfontein

    Joined:
    Sep 11, 2015
    Posts:
    16
    Hi, is this still the recommended workflow (I'd rather call it a workaround)? Or did the announced "easier way to create packages" work out to something better?
     
  8. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    There's no progress so far, but we'll be sure to let folks know once we have something to share.

    We suggest users test their sample at the location users will use them. So if you move the samples under the Assets folder, the problem will go away. We would like to implement a workflow to automate this process, but we're just not at a stage to look into doing that yet.
     
  9. JimboJonesBL

    JimboJonesBL

    Joined:
    Jul 16, 2020
    Posts:
    19
    Since this is often an issue in our package development process, I wanted to ask if there is any progress on that topic.

    What works for us at the moment is to create an Assembly Definition in the Scripts folder an link the needed Assembly Defs from the package. Before deployment the Assembly Definition file can be deleted (or ignored by your VCS)
     
    Last edited: Aug 8, 2022
    dgoodnow-ml likes this.