I have a number of questions about other peoples’ experience developing multiple applications with dependencies on shared packages in private registries.
Essentially, we have a couple of Unity applications that use a lot of common code. I’d like to separate the common parts out into Unity packages, which we can readily reuse in other Unity applications. However, I’m struggling to optimize the workflow here because the Unity editor seems to be more focused on a use case of “this is your game, this is all of its code, and it is just one big thing in one place right here” rather than a focus on multiple applications with shared code.
Now, I can export parts of the project to Unity packages and reimport them into other applications, of course. If I want to create a Unity package as a standalone project, in its own source control repository, I have to create a completely new Unity project for it. This is fine but it seems like a lot of overhead, especially when the component I’m developing is simple. Still, I can make packages, I’ve got that down.
One of the two main issues I’m running into is this: Often when developing an application, changes might need to be made to its dependency components during development. In other words, developing an application is often done in parallel with development of some of the shared components it is using. For example, we have a component that acts as a network client to one of our desktop applications, and a couple of separate AR applications that use that component. But if I’m developing a new feature in one of the AR applications that also requires some new features in the network client, I have to be able to work on both the application and the network client package at the same time.
The problem is I can’t really see any way to do this smoothly. If I’m working on the AR application and need to make a change to the network client (I’m using this as an example), the only process seems to be:
- Make changes to AR application.
- Open a second Unity editor and open the network client package project.
- Make changes to the network client
- Re-export the network client package, being sure to select the correct files when exporting (there doesn’t seem to be a way to save the list of selected files when exporting a package, or to automate the export)
- Switch back to the AR application project
- Re-import the network client package
- Continue working on the AR application.
But what I’d really like to do is something more like:
- Make changes to AR application.
- Open a second Unity editor and open the network client package project.
- Make changes to the network client.
- Magic happens and the changes are reflected in the AR application with no actions on my part
- Continue working on the AR application.
Or, even more ideal:
- Make changes to AR application.
- Make changes to the network client directly from the same editor.
- Continue working on the AR application.
- Commit and publish everything, where magic happens to make everything end up in the appropriate repositories and registries.
Now, I’m aware of private scoped package registry support in Unity (which I have set up successfully, and this will be part of my second issue below), but using them actually seems to make the workflow even worse by adding an intermediate publishing step, changing it to:
- Make changes to AR application.
- Open a second Unity editor and open the network client package project.
- Make changes to the network client.
- Commit the changes to source control (required for next step)
- Update the package version and re-publish to package registry.
- Switch back to the AR project.
- Update the package to the latest version with the new changes, using the Package Manage UI.
- Continue working on the AR application.
This is really an awful workflow especially when the changes to the package are small, such as a minor bug fix or a few lines of new feature code, or when the changes aren’t complete and so a version patch number upgrade isn’t appropriate yet.
My question is: For organizations that have a number of applications and a collection of code shared among those applications, how do they deal with this? What are the best practices for package development, especially when application and package development happen in parallel? How can I remove the tedium?
My second problem involves scoped package registries. The issue I’m running into is, currently we primarily use GitLab as our source control service, and GitLab also provides package registry services. Unfortunately, GitLab’s package registry service isn’t fully compatible with Unity’s package manager: In particular, it works, but Unity is unable to display a list of the packages in a GitLab registry. The consequence is that even if you add the registry to Unity, you can’t use the nice Package Manage UI to browse and select packages. You still have to custom add packages from the registry and enter their names manually, which doesn’t provide any workflow benefit over simply not using the registry at all and just adding packages by git URL.
Now, there are other services, I think, that provide package registries compatible with Unity. “Verdaccio” is one that seems to come up a lot in forum discussions and tutorials. But I’d like to avoid adding yet another 3rd-party service to our already-gigantic collection of tools. I’m working with our dev-ops lead to try to find other solutions but we have no good ideas yet. The other reason it would be ideal to stick to GitLab is we already use the GitLab package registry features for other non-Unity things, and it is nice to keep everything in one place.
So, my question there is: Specifically regarding GitLab, are there any organizations that effectively use GitLab’s registry services with Unity and, if so, how do they do it? Are there perhaps Unity Editor extensions that can help manage GitLab packages and development workflows? Or other tools we can use that will let us stay with GitLab?
My end goal is to make development of multiple applications with multiple shared packages as smooth as possible, with the most optimized workflow we can get. Basically, as smooth as, say, VS is, where multiple projects may be open at any one time, worked on simultaneously, and built together in one step.
In my experience, tedious workflows ultimately lead to poor quality products over time, as developers (including myself) who want to focus on coding start to invent fragile shortcuts around troublesome procedures. So, I’m trying to nail this down as much as possible now before our projects get much larger.
I hope this makes sense, sorry for the length.
Thanks!!