You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
To expand on that, to do it manually by editing the csproj file, under each configuration, there is a <DefineConstants> tag. It should look something like this:
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:
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:
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.The text was updated successfully, but these errors were encountered: