4 namespace UnityEditor
.Rendering
.PostProcessing
7 sealed class DefineSetter
9 const string k_Define
= "UNITY_POST_PROCESSING_STACK_V2";
13 var targets
= Enum
.GetValues(typeof(BuildTargetGroup
))
14 .Cast
<BuildTargetGroup
>()
15 .Where(x
=> x
!= BuildTargetGroup
.Unknown
)
16 .Where(x
=> !IsObsolete(x
));
18 foreach (var target
in targets
)
20 var defines
= PlayerSettings
.GetScriptingDefineSymbolsForGroup(target
).Trim();
22 var list
= defines
.Split(';', ' ')
23 .Where(x
=> !string.IsNullOrEmpty(x
))
26 if (list
.Contains(k_Define
))
30 defines
= list
.Aggregate((a
, b
) => a
+ ";" + b
);
32 PlayerSettings
.SetScriptingDefineSymbolsForGroup(target
, defines
);
36 static bool IsObsolete(BuildTargetGroup
group)
38 var attrs
= typeof(BuildTargetGroup
)
39 .GetField(group.ToString())
40 .GetCustomAttributes(typeof(ObsoleteAttribute
), false);
42 return attrs
!= null && attrs
.Length
> 0;