You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unity's project structure plays badly with the standard C# practice of making your namespace match your directory. The standard tools try to prepend Assets, with similar issues during package development.
Proposed solution
There should be an analyzer that's aware of Unity's standard layouts and suggests (and offers fixes for) appropriate automatic namespaces. It should work in the Assets directory, as well as in the Packages directory.
I've been trying to implement something like this myself, but I'm running into some difficulties. The usual way to get the base directory which namespaces should be relative to would be this:
This isn't set in Unity, and I can't find a particularly neat way of finding it. I can resort to techniques that walk the filesystem from the file's location looking for files that look like Unity manifests, but that's neither robust nor performant. If I could get some tips on non hacky ways to get appropriate base paths for all Unity project types, I could probably submit a PR for this.
The text was updated successfully, but these errors were encountered:
Problem statement
Unity's project structure plays badly with the standard C# practice of making your namespace match your directory. The standard tools try to prepend
Assets
, with similar issues during package development.Proposed solution
There should be an analyzer that's aware of Unity's standard layouts and suggests (and offers fixes for) appropriate automatic namespaces. It should work in the Assets directory, as well as in the Packages directory.
I've been trying to implement something like this myself, but I'm running into some difficulties. The usual way to get the base directory which namespaces should be relative to would be this:
This isn't set in Unity, and I can't find a particularly neat way of finding it. I can resort to techniques that walk the filesystem from the file's location looking for files that look like Unity manifests, but that's neither robust nor performant. If I could get some tips on non hacky ways to get appropriate base paths for all Unity project types, I could probably submit a PR for this.
The text was updated successfully, but these errors were encountered: