Unity integration having "Color" in default namespace
When trying to play with NoesisGUI and adding it to an existing project I noticed lots of compiler errors in non NoesisGUI related code. Searching a little revealed what the problem is:
Scripts / Noesis / Proxies has a whole lot of classes residing in the default namespace. One of them is "Color" - and since UnityEngine also defines Color (among others, of course), this is causing trouble. Because the root namespace is always available to every single class in the project - even when I don't say "using default"
Maybe you need to do this for some reason - but in general, it's really bad design to put stuff into the default namespace. The kind of "bad design" that actually breaks peoples projects by just adding your package. And the worst part of it: People may not even know it's you who broke their project because they'll see the compilation errors in somebody else's package (actually, one of the most annoying support cases I've ever had with ScoreFlash was for exactly that reason: some other author just put their stuff in the default namespace and then ScoreFlash threw compilation errors that were very misleading and confusing).
For MonoBehaviours and editor classes, unfortunately, Unity didn't support using namespaces in versions prior to 4.0; so if you inherit from MonoBehaviour (or some editor classes), *and* you want to support Unity "pre-4.0" (like 3.5.7), there's not much you can do.
For "Proxies", however, I'd really appreciate to have all those classes in their appropriate namespace Noesis.Proxies. That way, when I need any of them, I can say "using Noesis.Proxies" ... and in all other cases, it doesn't break my existing code
Scripts / Noesis / Proxies has a whole lot of classes residing in the default namespace. One of them is "Color" - and since UnityEngine also defines Color (among others, of course), this is causing trouble. Because the root namespace is always available to every single class in the project - even when I don't say "using default"

Maybe you need to do this for some reason - but in general, it's really bad design to put stuff into the default namespace. The kind of "bad design" that actually breaks peoples projects by just adding your package. And the worst part of it: People may not even know it's you who broke their project because they'll see the compilation errors in somebody else's package (actually, one of the most annoying support cases I've ever had with ScoreFlash was for exactly that reason: some other author just put their stuff in the default namespace and then ScoreFlash threw compilation errors that were very misleading and confusing).
For MonoBehaviours and editor classes, unfortunately, Unity didn't support using namespaces in versions prior to 4.0; so if you inherit from MonoBehaviour (or some editor classes), *and* you want to support Unity "pre-4.0" (like 3.5.7), there's not much you can do.
For "Proxies", however, I'd really appreciate to have all those classes in their appropriate namespace Noesis.Proxies. That way, when I need any of them, I can say "using Noesis.Proxies" ... and in all other cases, it doesn't break my existing code

-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Unity integration having "Color" in default namespace
Totally agree
That was something we fixed in current development and will be ready for the next release. All Noesis proxy classes will be under the Noesis namespace to avoid name collision.

That was something we fixed in current development and will be ready for the next release. All Noesis proxy classes will be under the Noesis namespace to avoid name collision.
-
- EisenbergEffect
- Posts: 19
- Joined:
Re: Unity integration having "Color" in default namespace
Excellent. I had't noticed the namespace issue just yet....but that's a big deal. Thanks for addressing it!
Re: Unity integration having "Color" in default namespace
Awesome! Thank you!That was something we fixed in current development and will be ready for the next release. All Noesis proxy classes will be under the Noesis namespace to avoid name collision.
-
- matt.rudder
- Posts: 21
- Joined:
- Location: San Francisco, CA
- Contact:
Re: Unity integration having "Color" in default namespace
It looks like this is currently addressed for Color and other similar classes, but some of the enum types (FontStyle, FontStretch, FillRule, etc) are still in the default namespace.
Would it be possible for you to move these types into the Noesis namespace along with the other classes?
Would it be possible for you to move these types into the Noesis namespace along with the other classes?
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Unity integration having "Color" in default namespace
We will upload a minor update to fix this, thanks to point it out.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 5 guests