ultimatexr-unity icon indicating copy to clipboard operation
ultimatexr-unity copied to clipboard

Package Folder Structure

Open nvandessel opened this issue 3 years ago • 6 comments

This PR shows the basic changes required to migrate this repository to a Unity Package hierarchy (defined here) so that it can be more easily integrated into a project and more easily maintained. I go into more detail here (https://github.com/VRMADA/ultimatexr-unity/discussions/3) as to why I think the repo should adopt this folder structure & import mechanism.

To test, add my branch to a project via the package manager through a gitURL. This will mimic what it would be like for an end user to add the package to their project. Or checkout my branch and select "Add package from disc..." to mimic what it would be like for a maintainer to add the package. HTTPS URL: https://github.com/nvandessel/ultimatexr-unity.git#feature/package-folder-structure

image

image

nvandessel avatar Sep 29 '22 00:09 nvandessel

Hi @nvandessel,

Thanks a lot for the pull request! As soon as we release our next update I will try to merge it. Adding the package support is our next top priority right now.

entromp avatar Oct 10 '22 11:10 entromp

Merged in your latest changes to the package structure, I haven't tested though, however; did not have any compile errors in Editor after resolving the conflicts. I choose all upstream/main and simply ensured things stayed in the correct directory.

One thing to note, I noticed that when the package is added from a GitHub URL it's technically read-only. This causes it to show an error when attempting to open the Example scene. This can simply be resolved by adding the package locally from a clone of the repository. Another option would be to have a .unitypackage within the package that extracts the scene to a directory in the project, a number of other VR SDKs use a pattern like this, which enables end-users to still utilize the package without cloning the repo.

nvandessel avatar Oct 13 '22 16:10 nvandessel

Thanks for merging the latest changes. Adding Package Folder Structure is our next goal right now.

entromp avatar Oct 18 '22 12:10 entromp

Merged in changes from v0.9.2

nvandessel avatar Oct 18 '22 15:10 nvandessel

I'm currently reviewing the folder structure and will do some preliminary tests using a private repo. \Art\Devices and \Scripts\Devices, although empty, should also be inside \Runtime. Is there a specific reason why they were left outside? I'm also wondering if we should rename Examples to Samples or if the name is OK as long as it's referenced also in the package.json section.

[Edit] I see, we use PlasticSCM internally and Git doesn't like empty folders. We probably will leave them out and create a separate repo for controller art.

entromp avatar Oct 19 '22 08:10 entromp

@entromp I don't see those folders, so maybe they weren't pushed because of the Git issue you were mentioning in your Edit.

In terms of renaming Examples to Samples, that might be better as that is what Unity recommends you name the folder - I just hadn't made the change. I'm also not 100% sure how strict Unity is on that, I feel like I've seen a variety of names including "Demo", "Examples", etc. I'll go ahead and rename it now though just to be on the safe side.

nvandessel avatar Oct 19 '22 15:10 nvandessel

I've added the following changes:

  • Moved the Hand Pose Editor presets to the Editor folder and added support for the Hand Pose Editor Window to load them in both modes (\Assets and package). This wasn't working correctly before.
  • Adjusted all editor script namespaces to mirror the new folder structure.
  • Added new ULTIMATEXR_PACKAGE symbol to detect when the framework was installed using the package manager.
  • Some other minor changes.

I'm going to fully test it again using this version and if everything goes well it should be ready to be merged to main. Please tell me if it also works on your side and if you have additional suggestions.

entromp avatar Oct 21 '22 14:10 entromp

Hi! I'll try to find time later tonight to do some testing, if I'm unable to this evening, I wont be able to test until tomorrow afternoon (PST). Everything looks correct in terms of organization though!

No suggestions right now, seems like you've got the package structure figured out now 😃

nvandessel avatar Oct 21 '22 15:10 nvandessel

Thanks! If everything is correct I hope to merge the pull request on Monday to officially release 0.9.3

entromp avatar Oct 21 '22 15:10 entromp

Exciting stuff! Thanks for working with me to unlock this!

nvandessel avatar Oct 21 '22 15:10 nvandessel

What would be the recommended way to provide users without git the possibility to install the package? I guess it would require a scoped registry and hosting the package yourself. I've found OpenUPM but it seems to work using a command-line interface instead of the Package Manager UI. It seems they tried to integrate it but at some point the Unity terms changed and now it's prohibited: https://github.com/openupm/openupm/discussions/10

entromp avatar Oct 24 '22 09:10 entromp

Personally we use Verdaccio which was recommended to us by Unity, however this has a similar issue of not displaying Packages within the Package Manager UI for things that are not currently installed. Once a package is installed though it does work and shows when updates are available, but I realize this is not a perfect UX.

It's definitely possible though because HTC has been supplying all their SDKs for the Focus3 through the package manger, and you're able to see all packages within their scoped registry within the package manager. I have a feeling that they might be using OpenUPM too, but not certain. I would recommend checking out their packages (if you haven't already), by just adding their scoped registry and then you can peek at their package.json as well to see how they have formatted things to ensure it plays nice.

Name: Vive
URL: https://npm-registry.vive.com/
Scopes: com.htc.upm

Users should be able to use the HTTPS URL without jumping through too many hoops with Git, basically just hit copy and paste into the package manager.

Another alternative is publishing on the Unity Asset Store, they accept (and might even prefer) package folder structure, that way user can import the asset from there. To do this I believe you just need to export a .unitypackage or you supply a directory (the root of this repo) and it creates the .unitypackage for you.

nvandessel avatar Oct 24 '22 16:10 nvandessel