User avatar
jashan
Topic Author
Posts: 13
Joined: 23 Mar 2013, 18:15
Contact:

Unity integration having "Color" in default namespace

26 Mar 2013, 12:46

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 ;-)
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Unity integration having "Color" in default namespace

26 Mar 2013, 14:18

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.
 
EisenbergEffect
Posts: 19
Joined: 22 Mar 2013, 15:09

Re: Unity integration having "Color" in default namespace

26 Mar 2013, 14:57

Excellent. I had't noticed the namespace issue just yet....but that's a big deal. Thanks for addressing it!
 
User avatar
jashan
Topic Author
Posts: 13
Joined: 23 Mar 2013, 18:15
Contact:

Re: Unity integration having "Color" in default namespace

29 Mar 2013, 19:00

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!
 
User avatar
matt.rudder
Posts: 21
Joined: 24 May 2013, 08:12
Location: San Francisco, CA
Contact:

Re: Unity integration having "Color" in default namespace

24 May 2013, 18:49

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?
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Unity integration having "Color" in default namespace

24 May 2013, 19:46

We will upload a minor update to fix this, thanks to point it out.

Who is online

Users browsing this forum: Bing [Bot] and 2 guests