stride3d / stride3d/stride

Preprocessor directive defines for Xenko and platforms

Open
#462 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area-Build enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.