Non-fatal errors on compilation - namespace conflicts?

Issue #28 resolved
Former user created an issue

So i installed the unity package today, on compiling the plugin, i started getting these errors every time unity finished recompiling.

Namespace problems

It was simple enough to put the demo and generically named scripts into namespaces,which removed the errors, but i thought it was weird because all of the Odin classes seemt to be in namespaces already?

Comments (6)

  1. Tor Esa Vestergaard

    All of Odin's classes are indeed in namespaces - it looks like your types are colliding with themselves. I presume, to provoke this error, you had types with the same full names (IE, namespace + type name) in different assemblies, for example, a type named "sui_demo_trigger" in the plugin folder, and a type named "sui_demo_trigger" outside of the plugin folder?

    If so, this one is kind of tricky to fix - we compile all of Odin's generated editors in a single pass, and there is no way to distinguish (in source text) between a type "Foo" in assembly A, versus a type "Foo" in assembly B if they have the same full name. If we had to do that, we would have to split Odin's compiled generators up into a separate assembly for each assembly that we generate editors for, which would greatly increase reload times whenever editors are regenerated, because there would be a lot of different assemblies for Unity to reload.

    If this is indeed the error, it is uncertain whether we are going to fix it or not, as the solution would likely be worse than the present state of things. We can, however, check for such name collisions ahead of time, and make sure that you get a better error message when this occurs, rather than the error spam of a failed compile.

    If it is not the case that you had types with the same names in different assemblies/Unity special compilation folders, then this is an error of a different sort, and we're going to need a bit more information to sort it out.

  2. Jacob Stove Lorentzen

    I think that was the case, i found each of the classes in question and namespaced/removed them (some were decrepit) no more errors atm.

    Nothing to worry about in that case i believe.

  3. Tor Esa Vestergaard
    • changed status to open

    In that case, I'm marking this as open until we've implemented the collision check and better error message, and then I'll mark it as won't fix.

  4. Tor Esa Vestergaard

    Patch (currently going through asset store approval) contains a fix for this error - decent warning messages are now shown, and editors will compile despite any type collisions, but we've also discovered that there may be a way to solve the issue properly and support compilation of editors with namespace conflicts, using extern aliases. I'll leave this open until we've given that a proper shot at some point.

  5. Tor Esa Vestergaard

    Odin's editor generation now handles type name conflicts properly, and is capable of compiling editors for types with conflicting names - so that should be it for this issue.

  6. Log in to comment