I'm working on a Unity/C# project where none of the files have namespaces. I like the idea of not having to manually add namespaces, and I like the idea of namespaces (somewhat) matching the folder structure. However, at the moment, using ReSharper's Adjust Namespaces
causes namespaces of the type Game
, Network
, etc, which can obviously cause problems with other namespaces.
Is it possible to somehow tell ReSharper to use a prefix (e.g. "projectname.", "companyname.", "com.company.project.", etc) for the randomly generated prefixes? Or do we actually have to put all the files in anther folder just to get this structure (a bit like what you'd do in Java, I guess)?
ReSharper uses the project's default namespace as prefix to the folder names.
So maybe it's enough for you to set this default namespace to your desired prefix and use "Adjust Namespaces" again.
To set the default namespace:
In Unity projects you'll have to set the "root namespace" in the Unity projects settings (as OP pointed out himself):
Edit -> Project Settings -> Editor -> Root namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With