Page 1 of 1

Unity integration having "Color" in default namespace

Posted: 26 Mar 2013, 12:46
by jashan
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 ;-)

Re: Unity integration having "Color" in default namespace

Posted: 26 Mar 2013, 14:18
by sfernandez
Totally agree :D

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.

Re: Unity integration having "Color" in default namespace

Posted: 26 Mar 2013, 14:57
by EisenbergEffect
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

Posted: 29 Mar 2013, 19:00
by jashan
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.
Awesome! Thank you!

Re: Unity integration having "Color" in default namespace

Posted: 24 May 2013, 18:49
by matt.rudder
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?

Re: Unity integration having "Color" in default namespace

Posted: 24 May 2013, 19:46
by sfernandez
We will upload a minor update to fix this, thanks to point it out.