- Home /
Question by
SarperS · Sep 17, 2015 at 12:42 PM ·
preprocessordefinesymbols
Reach Scripting Define Symbols in Runtime
Is there a way to list the "Scripting Define Symbols" in runtime? I know I can reach them through EditorUserBuildSettings.activeScriptCompilationDefines but I need a runtime version of it.
Alternatively I can also use a similar field in my own scripts, if the above is not possible, how can I parse a string as a preprocessor directive? I know that #if "some_string" wouldn't work. How does Unity #define those strings in the background anyway?
To provide some background info, what I want to do is, I want my script to delete the object if some preprocessor condition is met. And I want to assign those conditions through the Inspector. Like below.
public string[] conditions;
void Awake() {
#if conditions
Destroy(gameObject);
#endif
}
definesymbols.png
(29.1 kB)
Comment