Adding a package from hard disk does so with absolute pattern...

…which is absolutely useless in every use case I can envision.

We end up always fixing it with a relative path manually.

This would only make matters worse. As of now, you can at least move/rename/duplicate a project on the local system that has packages imported “from disk”.

You couldn’t do that anymore if those package paths were relative.

If you’re sharing the project with others, you should also share your packages alongside. You can put them in the same repository or import packages from individual git repositories. Or even set up your own package registry.

I see that you are saying that the Add From Disk is not designed for sharing purposes.

if so Add From Disk should be completely removed? Does it make sense only for personal solo projects?

Fixing the path to a relative path, allows us to share the local package relative to the project folder.

The point is, for solo devs it works perfectly fine, with or without the package being under source control.
It would also work for teams where the computers are managed to have their projects on a specific drive and path.

1 Like

Hi @sebas771 ,

Thanks for your feedback. We are aware that this UI is “limited” because it does not cover all potential cases. There are situations where a relative path (and using forward slashes for portability across OSes) is actually what you want, like you’re pointing out, but there are also situations where an absolute path makes more sense. Relative paths are great for sharing (if you’re also sharing the package setup in a way that guarantees the relative path is always valid, for instance if the packages are in the same repo as the project or always located in a standard location); absolute paths are better if you rely on the fact that you can move projects around locally on your machine to different locations/drives.

One small clarification: the C# PackageManager API does not force paths to be absolute. For instance, if you were to use UnityEditor.PackageManager.Client.Add("my-package@file:../../relative/path/to/package"), that would actually add “…/…/relative/path/to/package” to your project manifest. The problem you’re running into is with the Open File/Folder dialog which only returns absolute paths.

In the end, I agree with you that relative paths likely serves the more common use cases. However changing this feature now would break it for everyone who actually relies on those paths to be absolute. Instead, “fixing” this would likely involve providing options for you to choose how you want the path to be saved, when adding file-based dependencies. I’ll make sure we track this feature request. I can’t promise this will be implemented anytime soon, or that it will backported to any already-released Editor.

1 Like