What's the #if and endif keyword when creating plugins in C#?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By goodymind

In the Making Plugins documentation, it has the #if TOOl and endif keywords before and after the script. What does it do? and is it necessary?

:bust_in_silhouette: Reply From: rob405

From the Making Plugins documentation:
“In addition to the EditorPlugin script, any other GDScript that your plugin uses must also be a tool. Any GDScript without tool imported into the editor will act like an empty file!”

I’m not exactly sure why they’re written like this, but the #if TOOLS and #endif tell Godot that you are importing TOOLS in between the two keywords, which is mandatory for creating a plugin. The #if has to always be at the beginning of the script, and the #endif at the end.