- Home /
How to know and control which scripts are compiling?
(Apologies in advance for noob question...)
I have the same C# script in two different places: /Plugins/[PluginSubdirectory] and /Scripts/Other. Regardless of how I ended up like this, how can I know which of them will compile? How can I control it?
Thanks!
Answer by iwaldrop · Jun 27, 2013 at 06:03 PM
If they're exactly the same class (and in the same namespace) then I don't believe they will compile at all. In fact, you should get an error like the following:
< path to file > error CS0101: The namespace '' already contains a definition for '< class name >'
I'm getting all sorts of warnings, and one runtime error (IOException in a C# build script), but not that one. So either one of the scripts is not being compiled, or the error is being silenced, I think. And they definitely have the same name, and are not enclosed in any namespace. (Can it be that they get implicit namespaces?)
The IO Exception from the build script may be co$$anonymous$$g from the fact that the compiler gets confused when it identifies that there are two classes of the same type name in the assembly. Long story short, you'll have to remove one of them. You may need to refactor some code, but it sounds like you're taking something from the plugins directory and trying to make some tweaks to it. You could probably inherit from it ins$$anonymous$$d, and change the accessors to the method(s) that you're trying to replace protected virtual. That would allow you to override them in your inherited class.
The IOException happens at runtime (from a post-build script). I have removed it, and I'm getting no errors at all. Back to square one...
Your answer
Follow this Question
Related Questions
Notification of shader recompilation ? 2 Answers
Compilation Process 1 Answer
A simple 2D pong game doesn't run 1 Answer
IL2CPP Compiled Application's scripts not working 1 Answer
Calling C# Namespace from Boo 1 Answer