Friends, food, and flourishing

Unity: duplicate definitions in global namespace

Sometimes, I get this with a new project, when I add third-party assets:

Global namespace error

The namespace '<global namespace>' already contains a definition for 'something or other'

You can see the problem on the right. Two vendors used the same class name, without adding a namespace.

Here’s their code:

Two WaterReflection classes

As far as I can tell, this is just a careless error. The issue is well-known, and so is the solution: add your own namespaces.

There is no excuse for this. There could be mitigating factors I’m not aware of, but I don’t think so. If there are, please let me know in the comments.

I wrapped one of the classes:

namespace IgniteCoders
{
...
}

One of the assets only has one C# class, so it was the easier to fix.

Of course, if the asset is updated, the change will be lost, and I’ll have to do this again.

Annoying.

Two scripts defining the same class

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php