Scripting Defines
Reads and writes PlayerSettings scripting define symbols per named build target group.
Editor-only. Unity 2021.3+. Lives in Rivet.Editor (includePlatforms: Editor). No extra packages.
Editor window
ArTchie / Rivet / Scripting Defines
| Control | What it does |
|---|---|
| Standalone / Android / iOS / WebGL | Text area of ;-separated (or newline / comma) defines for that BuildTargetGroup. A group is omitted if the enum value does not exist. |
| EditorUser (read-only) | EditorUserBuildSettings.activeScriptCompilationDefines — what the Editor is compiling with now. |
| Reload | Re-reads PlayerSettings into the text areas. |
| Apply | Writes every editable group immediately. Undo is not available (confirmed in the status line). A domain reload / recompile follows. |
| Copy JSON | Puts the dump JSON on the clipboard. |
| Write report | Writes <project>/RivetReports/scripting-defines.json (creates the folder if needed). |
Batchmode (CI)
Default is a dump only. Mutation happens only when both group and defines args are present.
Unity -batchmode -nographics -quit -projectPath <proj> -executeMethod Rivet.ScriptingDefinesEditor.RunBatch -rivet-out <file.json>
Set Standalone defines:
Unity -batchmode -nographics -quit -projectPath <proj> -executeMethod Rivet.ScriptingDefinesEditor.RunBatch -rivet-group Standalone -rivet-defines "FOO;BAR"
| Arg | Meaning |
|---|---|
-rivet-out <file.json> |
Output path. Default: <project>/RivetReports/scripting-defines.json |
-rivet-fail |
Exit code 1 if a mutate was requested and failed (also exits 1 on any mutate/parse error) |
-rivet-group Standalone |
Target group. Case-insensitive. One of Standalone, Android, iOS, WebGL |
-rivet-defines "A;B;C" |
Replacement define list for that group. Empty string clears the group. |
RunBatch only calls EditorApplication.Exit when Application.isBatchMode is true. It logs count= and the output path.
Also accepts -rivet-out=file.json and -rivet-defines=A;B;C.
-rivet-group EditorUser is rejected (that list is read-only).
JSON
{
"tool": "ScriptingDefinesEditor",
"generatedUtc": "2026-08-18T02:00:00Z",
"count": 5,
"items": [
{
"group": "Standalone",
"defines": ["FOO"]
}
]
}
count is the number of groups in the dump (editable groups plus EditorUser). An empty project still emits one item per existing group, often with "defines": [].
Notes
- Uses
PlayerSettings.GetScriptingDefineSymbolsForGroup/SetScriptingDefineSymbolsForGroup(obsolete-warning silenced; the 2021.3 API the kit asked for). - Apply / batch set lock assembly reload until the report is written, then unlock (Unity will recompile).
- Does not write
EditorUserdefines. Extra compiler args /csc.rspare not edited. - Empty projects and a missing
RivetReportsfolder are fine. - Does not touch runtime player code.
Source in the box: Assets/ArTchie Studios/ArTchie-Suite/com.artchie.rivet/Documentation/ScriptingDefinesEditor.md