forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveDefineOnShutdown.cs
More file actions
34 lines (28 loc) · 954 Bytes
/
Copy pathRemoveDefineOnShutdown.cs
File metadata and controls
34 lines (28 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using UnityEditor.Build;
[InitializeOnLoad]
public class RemoveDefineOnShutdown
{
const string k_UnityPhysicsCustom = "UNITY_PHYSICS_CUSTOM";
const string k_CIEnvVar = "CI";
static RemoveDefineOnShutdown()
{
EditorApplication.quitting += RemoveDefine;
}
static void RemoveDefine()
{
var ciEnvVarOverride = Environment.GetEnvironmentVariable(k_CIEnvVar);
if (ciEnvVarOverride is not(null or ""))
{
var fromBuildTargetGroup = NamedBuildTarget.FromBuildTargetGroup(BuildTargetGroup.Standalone);
string defineSymbols = PlayerSettings.GetScriptingDefineSymbols(fromBuildTargetGroup);
defineSymbols = defineSymbols.Replace($";{k_UnityPhysicsCustom}", "");
PlayerSettings.SetScriptingDefineSymbols(fromBuildTargetGroup, defineSymbols);
}
}
}
#endif