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
  • Loading branch information
ericf authored and ericf committed Aug 12, 2024
1 parent 2c6e25b commit 2a8662e
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 @@ -657,6 +657,30 @@ packages from private UPM registries. To create this file, first create the
`/home/runner/work/_temp/_github_home` directory, and then create the .upmconfig.toml file inside
that directory. This action must be done before running the game-ci/unity-builder@v4 action.

## 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
}
```

```yaml
- name: Create .upmconfig.toml UPM authentication file
run: |
Expand Down

0 comments on commit 2a8662e

Please sign in to comment.