GetScriptingDefineSymbols
Gets the array of symbols for script compilation for the build target you select. Symbols are semicolon-separated. For example, "SYMBOL1;SYMBOL2".
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor
GetScriptingDefineSymbols(NamedBuildTarget)
Gets the array of symbols for script compilation for the build target you select. Symbols are semicolon-separated. For example, "SYMBOL1;SYMBOL2".
public static string GetScriptingDefineSymbols(NamedBuildTarget buildTarget)
Parameters
The NamedBuildTarget.
Returns
Type | Description |
|---|---|
| string |
Remarks
This method returns only the symbols stored in the Player settings. It doesn't include the symbols that an active build profile adds through BuildProfile.scriptingDefines.
Unity compiles scripts against both sets of symbols. To get the symbols that the active build profile contributes, read BuildProfile.scriptingDefines on that profile.
Examples
using UnityEditor;using UnityEditor.Build;using UnityEngine;public class GetScriptingDefineSymbolsExample{ [MenuItem("Tools/Log Scripting Define Symbols")] static void LogScriptingDefineSymbols() { // Using built-in constants. string standaloneDefines = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.Standalone); UnityEngine.Debug.Log("Standalone: " + standaloneDefines); // Migrating from BuildTargetGroup. NamedBuildTarget namedTarget = NamedBuildTarget.FromBuildTargetGroup(BuildTargetGroup.Android); string androidDefines = PlayerSettings.GetScriptingDefineSymbols(namedTarget); UnityEngine.Debug.Log("Android: " + androidDefines); }}
GetScriptingDefineSymbols(NamedBuildTarget, string[])
Gets the array of user-specified symbols for script compilation for the build target you select.
public static void GetScriptingDefineSymbols(NamedBuildTarget buildTarget, out string[] defines)
Parameters
Remarks
This overload returns only the symbols stored in the Player settings. It doesn't include the symbols that an active build profile adds through BuildProfile.scriptingDefines.