Preprocessor directive defines for Xenko and platforms
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Godot recently merged this pull request which allows end-user code to have preprocessor directives to check if the code is running in Godot or if it's on a certain platform. For example, I can do this:
#if GODOT
GD.Print("This is Godot");
#else
throw new InvalidWorkflowException("Only Godot is supported");
#endif
With this feature, it is possible to write code that can run on multiple engines, by enabling/disabling different code depending on the engine. I would like to do something like this:
#if GODOT
GD.Print("This is Godot.");
#elif XENKO
Log.Info("This is Xenko.");
#else
throw new InvalidWorkflowException("Only Godot and Xenko are supported.");
#endif
Additionally, this kind of feature could be useful for intra-Xenko uses, for example, you could have a define called XENKO_WINDOWS and use that to wrap around any Windows-specific code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating where C# preprocessor symbols are configured for Xenko and platform-specific builds, then define the supported symbols and verify that user code can distinguish engines and platforms as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100