diff --git a/docs/03-github/04-builder.mdx b/docs/03-github/04-builder.mdx index 0a739c67..a51e8572 100644 --- a/docs/03-github/04-builder.mdx +++ b/docs/03-github/04-builder.mdx @@ -667,6 +667,30 @@ that directory. This action must be done before running the game-ci/unity-builde echo "token = \"${{ secrets.NPM_TOKEN }}\"" >> .upmconfig.toml ``` +## Using preprocessor macros + +If needed, Unity preprocessor directives can be set by adding a step to the build. + +```yaml +steps: + - name: Apply csc.rsp (pre-processor symbols) + run: echo -define:MY_SYMBOL >> Assets/csc.rsp +``` + +To avoid warnings about "unapplied changes", add `Assets/csc.rsp` in your `.gitignore` + +Once set, you can then reference these preprocessor directives in code: + +```c +void Start() { +#if MY_SYMBOL + GetComponent().text = "I have a symbol!"; +#else + GetComponent().text = "I do not have a symbol..."; +#endif +} +``` + ## Complete example A complete workflow that builds every available platform could look like this: