tree sway and shadow improvements
[WindSway-HDRP.git] / Library / PackageCache / com.unity.postprocessing@2.1.2 / PostProcessing / Editor / Tools / DefineSetter.cs
blob1083590a174c2090c6dbcf5d554bdc86e77a27ff
1 using System;
2 using System.Linq;
4 namespace UnityEditor.Rendering.PostProcessing
6 [InitializeOnLoad]
7 sealed class DefineSetter
9 const string k_Define = "UNITY_POST_PROCESSING_STACK_V2";
11 static DefineSetter()
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))
24 .ToList();
26 if (list.Contains(k_Define))
27 continue;
29 list.Add(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;