Skip to content

Commit

Permalink
Update the build documentation with a note about how to set preproces…
Browse files Browse the repository at this point in the history
…sor macros (#474)

Co-authored-by: ericf <ericf@VENGEANCE>
Co-authored-by: David Finol <davidmfinol@gmail.com>
  • Loading branch information
3 people authored Oct 5, 2024
1 parent 9e5f942 commit 0144de1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/03-github/04-builder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<TMP_Text>().text = "I have a symbol!";
#else
GetComponent<TMP_Text>().text = "I do not have a symbol...";
#endif
}
```

## Complete example

A complete workflow that builds every available platform could look like this:
Expand Down

0 comments on commit 0144de1

Please sign in to comment.