Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preprocessor defines for C#/Mono #27227

Closed
wfowler1 opened this issue Mar 19, 2019 · 2 comments · Fixed by #28786
Closed

Preprocessor defines for C#/Mono #27227

wfowler1 opened this issue Mar 19, 2019 · 2 comments · Fixed by #28786

Comments

@wfowler1
Copy link

The what: It would be great if Godot could automatically add a preprocessor define to the project for Mono. I believe Unity has done this since version 2.6.0.

The why: It's very convenient to be able to use the same source code in different places. I have built and still maintain a C# library for reading BSP files (from the Source engine, for example), and I've been able to make it work in .NET standalone projects as well as Unity by using Unity's C# preprocessor defines. I'd love to add support for Godot the same way. The project is at https://github.com/wfowler1/LibBSP

The how: It would probably be sufficient to simply add "GODOT" to the DefineConstants section of each build configuration in the CSPROJ. Then in C# code we could simply wrap Godot-specific code in #if GODOT and ENDIF.

@wfowler1
Copy link
Author

Unity uses this to allow conditional compiling of code based on the version of Unity being used. This might be an ok thing to have, but I'm more interested in compiling for the engine as a whole rather than any specific version, which is actually something Unity lacks.

@aaronfranke
Copy link
Member

I believe Unity has done this since version 2.6.0.

Unity has had this feature since Unity 5.3 (released in 2015).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants