Reputation: 1601
I'm working on a Unity (v2019.1.11) project where I have the following case of a class that is being included via a git submodule
from another project where the namespace (CustomNameSpace
) exists:
#if FLAG
using CustomNameSpace;
public class Foo
{
}
#endif
In my project at hand CustomNameSpace
does not exist. Therefore I thought that unless I define FLAG
in Unity's player settings, the file containing this code would be treated as if it was empty. However, even though FLAG
is undefined, Unity is throwing an error for the missing namespace.
I would like to know how to correctly being able to avoid code files to be compiled or even checked by Unity.
EDIT:
I already have checked that:
- FLAG
is not defined in the Unity player settings
- FLAG
is not defined in any code file in the solution
- FLAG
is not defined in Assets\csc.rsp
as described here
Upvotes: 0
Views: 499
Reputation: 1334
This flag is being defined somewhere in your project, either inside the script or inside unity's project settings.
You need to find where it is being defined and remove the definition, so unity doesn't compile the code inside it.
1) It can be defined in your unity project settings window, to find it: Edit => Project Settings => Player tab, then find the text input field the one in the green box in this , you'll probably find the FLAG symbol being defined there, remove it.
2) Or could be defined somewhere in your code, to find it: I will assume you're using visual studio as your IDE, press CTRL+ SHIFT + F and search your whole solution for this line of code #define FLAG
this line is what defines your flag and making unity recognize the flag as being currently true, thus compiling the code inside it, it is the line you wanna remove.
Upvotes: 1