summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsQuestLegacy/Assets/VRCSDK/Dependencies/VRChat/Editor/EnvConfig.cs
blob: 3337377dc64e6a744e2ddd913a820f1c9c93d0e4 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
#define ENV_SET_INCLUDED_SHADERS

using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine.Rendering;
using VRC.SDKBase.Validation.Performance.Stats;
using Object = UnityEngine.Object;

/// <summary>
/// Setup up SDK env on editor launch
/// </summary>
[InitializeOnLoad]
public class EnvConfig
{
    private static readonly BuildTarget[] relevantBuildTargets =
    {
        BuildTarget.Android,
        BuildTarget.iOS,
        BuildTarget.StandaloneLinux64,
        BuildTarget.StandaloneWindows, BuildTarget.StandaloneWindows64,
        BuildTarget.StandaloneOSX
    };

    #if !VRC_CLIENT
    private static readonly BuildTarget[] allowedBuildtargets = {
        BuildTarget.StandaloneWindows64,
        BuildTarget.Android
    };
    #endif

    private static readonly Dictionary<BuildTarget, GraphicsDeviceType[]> allowedGraphicsAPIs = new Dictionary<BuildTarget, GraphicsDeviceType[]>()
    {
        {BuildTarget.Android, new[] {GraphicsDeviceType.OpenGLES3, /* GraphicsDeviceType.Vulkan */}},
        {BuildTarget.iOS, null},
        {BuildTarget.StandaloneLinux64, null},
        {BuildTarget.StandaloneWindows, new[] {GraphicsDeviceType.Direct3D11}},
        {BuildTarget.StandaloneWindows64, new[] {GraphicsDeviceType.Direct3D11}},
        {BuildTarget.StandaloneOSX, null}
    };

    #if ENV_SET_INCLUDED_SHADERS && VRC_CLIENT
    private static readonly string[] ensureTheseShadersAreAvailable =
    {
        "Hidden/CubeBlend",
        "Hidden/CubeBlur",
        "Hidden/CubeCopy",
        "Hidden/VideoDecode",
        "Legacy Shaders/Bumped Diffuse",
        "Legacy Shaders/Bumped Specular",
        "Legacy Shaders/Decal",
        "Legacy Shaders/Diffuse Detail",
        "Legacy Shaders/Diffuse Fast",
        "Legacy Shaders/Diffuse",
        "Legacy Shaders/Diffuse",
        "Legacy Shaders/Lightmapped/Diffuse",
        "Legacy Shaders/Lightmapped/Specular",
        "Legacy Shaders/Lightmapped/VertexLit",
        "Legacy Shaders/Parallax Diffuse",
        "Legacy Shaders/Parallax Specular",
        "Legacy Shaders/Reflective/Bumped Diffuse",
        "Legacy Shaders/Reflective/Bumped Specular",
        "Legacy Shaders/Reflective/Bumped Unlit",
        "Legacy Shaders/Reflective/Bumped VertexLit",
        "Legacy Shaders/Reflective/Diffuse",
        "Legacy Shaders/Reflective/Parallax Diffuse",
        "Legacy Shaders/Reflective/Parallax Specular",
        "Legacy Shaders/Reflective/Specular",
        "Legacy Shaders/Reflective/VertexLit",
        "Legacy Shaders/Self-Illumin/Bumped Diffuse",
        "Legacy Shaders/Self-Illumin/Bumped Specular",
        "Legacy Shaders/Self-Illumin/Diffuse",
        "Legacy Shaders/Self-Illumin/Parallax Diffuse",
        "Legacy Shaders/Self-Illumin/Parallax Specular",
        "Legacy Shaders/Self-Illumin/Specular",
        "Legacy Shaders/Self-Illumin/VertexLit",
        "Legacy Shaders/Specular",
        "Legacy Shaders/Transparent/Bumped Diffuse",
        "Legacy Shaders/Transparent/Bumped Specular",
        "Legacy Shaders/Transparent/Cutout/Bumped Diffuse",
        "Legacy Shaders/Transparent/Cutout/Bumped Specular",
        "Legacy Shaders/Transparent/Cutout/Diffuse",
        "Legacy Shaders/Transparent/Cutout/Soft Edge Unlit",
        "Legacy Shaders/Transparent/Cutout/Specular",
        "Legacy Shaders/Transparent/Cutout/VertexLit",
        "Legacy Shaders/Transparent/Diffuse",
        "Legacy Shaders/Transparent/Parallax Diffuse",
        "Legacy Shaders/Transparent/Parallax Specular",
        "Legacy Shaders/Transparent/Specular",
        "Legacy Shaders/Transparent/VertexLit",
        "Legacy Shaders/VertexLit",
        "Legacy Shaders/Particles/Additive",
        "Legacy Shaders/Particles/~Additive-Multiply",
        "Legacy Shaders/Particles/Additive (Soft)",
        "Legacy Shaders/Particles/Alpha Blended",
        "Legacy Shaders/Particles/Anim Alpha Blended",
        "Legacy Shaders/Particles/Multiply",
        "Legacy Shaders/Particles/Multiply (Double)",
        "Legacy Shaders/Particles/Alpha Blended Premultiply",
        "Legacy Shaders/Particles/VertexLit Blended",
        "Mobile/Particles/Additive",
        "Mobile/Particles/Alpha Blended",
        "Mobile/Particles/Multiply",
        "Mobile/Particles/VertexLit Blended",
        "Mobile/Skybox",
        "Nature/Terrain/Diffuse",
        "Nature/Terrain/Specular",
        "Nature/Terrain/Standard",
        "Particles/Additive (Soft)",
        "Particles/Additive",
        "Particles/Alpha Blended Premultiply",
        "Particles/Alpha Blended",
        "Particles/Anim Alpha Blended",
        "Particles/Multiply (Double)",
        "Particles/Multiply",
        "Particles/VertexLit Blended",
        "Particles/~Additive-Multiply",
        "Skybox/Cubemap",
        "Skybox/Procedural",
        "Skybox/6 Sided",
        "Sprites/Default",
        "Sprites/Diffuse",
        "UI/Default",
        "VRChat/UI/Unlit/WebPanelTransparent",
        "Toon/Lit",
        "Toon/Lit (Double)",
        "Toon/Lit Cutout",
        "Toon/Lit Cutout (Double)",
        "Toon/Lit Outline",
        "VRChat/Mobile/Diffuse",
        "Video/RealtimeEmissiveGamma",
        "VRChat/PC/Toon Lit",
        "VRChat/PC/Toon Lit (Double)",
        "VRChat/PC/Toon Lit Cutout",
        "VRChat/PC/Toon Lit Cutout (Double)",
        "Unlit/Color",
        "Unlit/Transparent",
        "Unlit/Transparent Cutout",
        "Unlit/Texture",
        "MatCap/Vertex/Textured Lit",
        "VRChat/Mobile/Bumped Uniform Diffuse",
        "VRChat/Mobile/Bumped Uniform Specular",
        "VRChat/Mobile/Toon Lit",
        "VRChat/Mobile/MatCap Lit",
        "VRChat/Mobile/Skybox",
        "VRChat/Mobile/Lightmapped",
        "VRChat/Mobile/Bumped Mapped Specular",
        "VRChat/Mobile/Diffuse",
        "VRChat/Mobile/Particles/Additive",
        "VRChat/Mobile/Particles/Multiply",
        "VRChat/Mobile/Standard Lite",
        "TextMeshPro/Distance Field (Surface)",
        "TextMeshPro/Mobile/Distance Field (No ZTest)",
        "TextMeshPro/Distance Field Overlay",
        "TextMeshPro/Sprite",
        "TextMeshPro/Mobile/Distance Field - Masking",
        "TextMeshPro/Mobile/Distance Field Overlay",
        "TextMeshPro/Mobile/Distance Field (Surface)",
        "TextMeshPro/Mobile/Distance Field",
        "TextMeshPro/Distance Field",
        "TextMeshPro/Bitmap Custom Atlas",
        "VRChat/UI/TextMeshPro/Mobile/Distance Field",
        "TextMeshPro/Mobile/Bitmap",
        "TextMeshPro/Bitmap",
        "TextMeshPro/Mobile/Distance Field - Masking (NoZTest)"
    };
    #endif

    private static bool _requestConfigureSettings = true;

    static EnvConfig()
    {
        EditorApplication.update += EditorUpdate;
    }

    private static void EditorUpdate()
    {
        if(!_requestConfigureSettings)
        {
            return;
        }

        if(ConfigureSettings())
        {
            _requestConfigureSettings = false;
        }
    }

    public static void RequestConfigureSettings()
    {
        _requestConfigureSettings = true;
    }

    [UnityEditor.Callbacks.DidReloadScripts(int.MaxValue)]
    private static void DidReloadScripts()
    {
        RequestConfigureSettings();
    }

    public static bool ConfigureSettings()
    {
        CheckForFirstInit();

        if(EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isUpdating)
        {
            return false;
        }

        ConfigurePlayerSettings();

        if(!VRC.Core.ConfigManager.RemoteConfig.IsInitialized())
        {
            VRC.Core.API.SetOnlineMode(true, "vrchat");
            VRC.Core.ConfigManager.RemoteConfig.Init();
        }

        ConfigureAssets();
        
        LoadEditorResources();

        return true;
    }
    
    #if !VRC_CLIENT
    private static void SetDLLPlatforms(string dllName, bool active)
    {
        string[] assetGuids = AssetDatabase.FindAssets(dllName);

        foreach(string guid in assetGuids)
        {
            string dllPath = AssetDatabase.GUIDToAssetPath(guid);
            if(string.IsNullOrEmpty(dllPath) || dllPath.ToLower().EndsWith(".dll") == false)
            {
                return;
            }

            PluginImporter importer = AssetImporter.GetAtPath(dllPath) as PluginImporter;
            if(importer == null)
            {
                return;
            }

            bool allCorrect = true;
            if(importer.GetCompatibleWithAnyPlatform() != active)
            {
                allCorrect = false;
            }
            else
            {
                if(importer.GetCompatibleWithAnyPlatform())
                {
                    if(importer.GetExcludeEditorFromAnyPlatform() != !active ||
                       importer.GetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows) != !active)
                    {
                        allCorrect = false;
                    }
                }
                else
                {
                    if(importer.GetCompatibleWithEditor() != active ||
                       importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows) != active)
                    {
                        allCorrect = false;
                    }
                }
            }

            if(allCorrect)
            {
                continue;
            }

            if(active)
            {
                importer.SetCompatibleWithAnyPlatform(true);
                importer.SetExcludeEditorFromAnyPlatform(false);
                importer.SetExcludeFromAnyPlatform(BuildTarget.Android, false);
                importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows, false);
                importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows64, false);
                importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneLinux64, false);
            }
            else
            {
                importer.SetCompatibleWithAnyPlatform(false);
                importer.SetCompatibleWithEditor(false);
                importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
            }

            importer.SaveAndReimport();
        }
    }
    #endif

    [MenuItem("VRChat SDK/Utilities/Force Configure Player Settings")]
    public static void ConfigurePlayerSettings()
    {
        VRC.Core.Logger.Log("Setting required PlayerSettings...", VRC.Core.DebugLevel.All);

        SetBuildTarget();

        // Needed for Microsoft.CSharp namespace in DLLMaker
        // Doesn't seem to work though
        if(PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup) != ApiCompatibilityLevel.NET_4_6)
        {
            PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup, ApiCompatibilityLevel.NET_4_6);
        }

        if(!PlayerSettings.runInBackground)
        {
            PlayerSettings.runInBackground = true;
        }

        #if !VRC_CLIENT
        SetDLLPlatforms("VRCCore-Standalone", false);
        SetDLLPlatforms("VRCCore-Editor", true);
        #endif

        SetDefaultGraphicsAPIs();
        SetGraphicsSettings();
        SetQualitySettings();
        SetAudioSettings();
        SetPlayerSettings();

        #if VRC_CLIENT
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        PlatformSwitcher.RefreshRequiredPackages(EditorUserBuildSettings.selectedBuildTargetGroup);
        #else
        // SDK

        // default to steam runtime in sdk (shouldn't matter)
        SetVRSDKs(EditorUserBuildSettings.selectedBuildTargetGroup, new string[] { "None", "OpenVR", "Oculus" });

        VRC.Core.AnalyticsSDK.Initialize(VRC.Core.SDKClientUtilities.GetSDKVersionDate());
        #endif

        #if VRC_CLIENT
        // VRCLog should handle disk writing
        PlayerSettings.usePlayerLog = false;
        foreach(LogType logType in Enum.GetValues(typeof(LogType)).Cast<LogType>())
        {
            switch(logType)
            {
                case LogType.Assert:
                case LogType.Exception:
                {
                    PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.ScriptOnly);
                    break;
                }
                case LogType.Error:
                case LogType.Warning:
                case LogType.Log:
                {
                    #if UNITY_EDITOR
                    PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.ScriptOnly);
                    #else
                    PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.None);
                    #endif 
                    break;
                }
                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
        #endif
    }

    private static void EnableBatching(bool enable)
    {
        PlayerSettings[] playerSettings = Resources.FindObjectsOfTypeAll<PlayerSettings>();
        if(playerSettings == null)
        {
            return;
        }

        SerializedObject playerSettingsSerializedObject = new SerializedObject(playerSettings.Cast<UnityEngine.Object>().ToArray());
        SerializedProperty batchingSettings = playerSettingsSerializedObject.FindProperty("m_BuildTargetBatching");
        if(batchingSettings == null)
        {
            return;
        }

        for(int i = 0; i < batchingSettings.arraySize; i++)
        {
            SerializedProperty batchingArrayValue = batchingSettings.GetArrayElementAtIndex(i);

            IEnumerator batchingEnumerator = batchingArrayValue?.GetEnumerator();
            if(batchingEnumerator == null)
            {
                continue;
            }

            while(batchingEnumerator.MoveNext())
            {
                SerializedProperty property = (SerializedProperty)batchingEnumerator.Current;

                if(property != null && property.name == "m_BuildTarget")
                {
                    // only change setting on "Standalone" entry
                    if(property.stringValue != "Standalone")
                    {
                        break;
                    }
                }

                if(property != null && property.name == "m_StaticBatching")
                {
                    property.boolValue = enable;
                }

                if(property != null && property.name == "m_DynamicBatching")
                {
                    property.boolValue = enable;
                }
            }
        }

        playerSettingsSerializedObject.ApplyModifiedProperties();
    }

    public static void SetVRSDKs(BuildTargetGroup buildTargetGroup, string[] sdkNames)
    {
        VRC.Core.Logger.Log("Setting virtual reality SDKs in PlayerSettings: ", VRC.Core.DebugLevel.All);
        if(sdkNames != null)
        {
            foreach(string s in sdkNames)
            {
                VRC.Core.Logger.Log("- " + s, VRC.Core.DebugLevel.All);
            }
        }

        if (!EditorApplication.isPlaying)
        {
            #pragma warning disable 618
            PlayerSettings.SetVirtualRealitySDKs(buildTargetGroup, sdkNames);
            #pragma warning restore 618
        }
    }

    public static bool CheckForFirstInit()
    {
        bool firstLaunch = SessionState.GetBool("EnvConfigFirstLaunch", true);
        if(firstLaunch)
        {
            SessionState.SetBool("EnvConfigFirstLaunch", false);
        }

        return firstLaunch;
    }

    private static void SetDefaultGraphicsAPIs()
    {
        VRC.Core.Logger.Log("Setting Graphics APIs", VRC.Core.DebugLevel.All);
        foreach(BuildTarget target in relevantBuildTargets)
        {
            GraphicsDeviceType[] apis = allowedGraphicsAPIs[target];
            if(apis == null)
            {
                SetGraphicsAPIs(target, true);
            }
            else
            {
                SetGraphicsAPIs(target, false, apis);
            }
        }
    }

    private static void SetGraphicsAPIs(BuildTarget platform, bool auto, GraphicsDeviceType[] allowedTypes = null)
    {
        try
        {
            if(auto != PlayerSettings.GetUseDefaultGraphicsAPIs(platform))
            {
                PlayerSettings.SetUseDefaultGraphicsAPIs(platform, auto);
            }
        }
        catch
        {
            // ignored
        }

        try
        {
            if(allowedTypes == null || allowedTypes.Length == 0)
            {
                return;
            }

            GraphicsDeviceType[] graphicsAPIs = PlayerSettings.GetGraphicsAPIs(platform);
            if(graphicsAPIs == null || graphicsAPIs.Length == 0)
            {
                return;
            }

            if(allowedTypes.SequenceEqual(graphicsAPIs))
            {
                return;
            }

            PlayerSettings.SetGraphicsAPIs(platform, allowedTypes);
        }
        catch
        {
            // ignored
        }
    }

    private static void SetQualitySettings()
    {
        VRC.Core.Logger.Log("Setting Graphics Settings", VRC.Core.DebugLevel.All);
        const string qualitySettingsAssetPath = "ProjectSettings/QualitySettings.asset";
        SerializedObject qualitySettings = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(qualitySettingsAssetPath)[0]);

        SerializedProperty qualitySettingsPresets = qualitySettings.FindProperty("m_QualitySettings");
            qualitySettingsPresets.arraySize = _graphicsPresets.Length;

        bool changedProperty = false;
        for(int index = 0; index < _graphicsPresets.Length; index++)
        {
            SerializedProperty currentQualityLevel = qualitySettingsPresets.GetArrayElementAtIndex(index);
            Dictionary<string, object> graphicsPreset = _graphicsPresets[index];
            foreach(KeyValuePair<string, object> setting in graphicsPreset)
            {
                SerializedProperty property = currentQualityLevel.FindPropertyRelative(setting.Key);
                if(property == null)
                {
                    Debug.LogWarning($"Serialized property for quality setting '{setting.Key}' could not be found.");
                    continue;
                }

                object settingValue = setting.Value;
                #if !VRC_CLIENT
                if(setting.Key == "name")
                {
                    settingValue = $"VRC {setting.Value}";
                }
                #endif

                switch(settingValue)
                {
                    case null:
                    {
                        if(property.objectReferenceValue == setting.Value as Object)
                        {
                            continue;
                        }

                        property.objectReferenceValue = null;
                        break;
                    }
                    case string settingAsString:
                    {
                        if(property.stringValue == settingAsString)
                        {
                            continue;
                        }

                        property.stringValue = settingAsString;
                        break;
                    }
                    case bool settingAsBool:
                    {
                        if(property.boolValue == settingAsBool)
                        {
                            continue;
                        }

                        property.boolValue = settingAsBool;
                        break;
                    }
                    case int settingAsInt:
                    {
                        if(property.intValue == settingAsInt)
                        {
                            continue;
                        }

                        property.intValue = settingAsInt;
                        break;
                    }
                    case float settingAsFloat:
                    {
                        if(Mathf.Approximately(property.floatValue, settingAsFloat))
                        {
                            continue;
                        }

                        property.floatValue = settingAsFloat;
                        break;
                    }
                    case double settingAsDouble:
                    {
                        if(Mathf.Approximately((float)property.doubleValue, (float)settingAsDouble))
                        {
                            continue;
                        }

                        property.doubleValue = settingAsDouble;
                        break;
                    }
                    case Vector3 settingAsVector3:
                    {
                        if(property.vector3Value == settingAsVector3)
                        {
                            continue;
                        }

                        property.vector3Value = settingAsVector3;
                        break;
                    }
                    case string[] settingAsStringArray:
                    {
                        property.arraySize = settingAsStringArray.Length;

                        bool changedArrayEntry = false;
                        for(int settingIndex = 0; settingIndex < settingAsStringArray.Length; settingIndex++)
                        {
                            SerializedProperty entry = property.GetArrayElementAtIndex(settingIndex);
                            if(entry.stringValue == settingAsStringArray[settingIndex])
                            {
                                continue;
                            }

                            entry.stringValue = settingAsStringArray[settingIndex];
                            changedArrayEntry = true;
                        }

                        if(!changedArrayEntry)
                        {
                            continue;
                        }

                        break;
                    }
                }

                #if !VRC_CLIENT
                string levelName = _graphicsPresets[index]["name"] as string;
                if(Application.isMobilePlatform)
                {
                    if(levelName == "Mobile")
                    {
                        Debug.Log($"Set incorrect quality setting '{setting.Key}' in level '{levelName}' to value '{setting.Value}'.");
                    }
                }
                else
                {
                    if(levelName != "Mobile")
                    {
                        Debug.Log($"Set incorrect quality setting '{setting.Key}' in level '{levelName}' to value '{setting.Value}'.");
                    }
                }

                #endif
                changedProperty = true;
            }
        }

        if(!changedProperty)
        {
            return;
        }

        int defaultQuality = !Application.isMobilePlatform ? 3 : 4;
        #if !VRC_CLIENT
        Debug.Log($"A quality setting was changed resetting to the default quality: {_graphicsPresets[defaultQuality]["name"]}.");
        #endif
        SerializedProperty currentGraphicsQuality = qualitySettings.FindProperty("m_CurrentQuality");
        currentGraphicsQuality.intValue = defaultQuality;

        qualitySettings.ApplyModifiedPropertiesWithoutUndo();
        AssetDatabase.SaveAssets();
    }

    private static void SetGraphicsSettings()
    {
        VRC.Core.Logger.Log("Setting Graphics Settings", VRC.Core.DebugLevel.All);

        const string graphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(graphicsSettingsAssetPath)[0]);

        SerializedProperty deferred = graphicsManager.FindProperty("m_Deferred.m_Mode");
        deferred.enumValueIndex = 1;

        SerializedProperty deferredReflections = graphicsManager.FindProperty("m_DeferredReflections.m_Mode");
        deferredReflections.enumValueIndex = 1;

        SerializedProperty screenSpaceShadows = graphicsManager.FindProperty("m_ScreenSpaceShadows.m_Mode");
        screenSpaceShadows.enumValueIndex = 1;

        SerializedProperty legacyDeferred = graphicsManager.FindProperty("m_LegacyDeferred.m_Mode");
        legacyDeferred.enumValueIndex = 1;

        SerializedProperty depthNormals = graphicsManager.FindProperty("m_DepthNormals.m_Mode");
        depthNormals.enumValueIndex = 1;

        SerializedProperty motionVectors = graphicsManager.FindProperty("m_MotionVectors.m_Mode");
        motionVectors.enumValueIndex = 1;

        SerializedProperty lightHalo = graphicsManager.FindProperty("m_LightHalo.m_Mode");
        lightHalo.enumValueIndex = 1;

        SerializedProperty lensFlare = graphicsManager.FindProperty("m_LensFlare.m_Mode");
        lensFlare.enumValueIndex = 1;

        #if ENV_SET_INCLUDED_SHADERS && VRC_CLIENT
        // clear GraphicsSettings->Always Included Shaders - these cause a +5s app startup time increase on Quest.
        // include Shader objects as resources instead
        SerializedProperty alwaysIncluded = graphicsManager.FindProperty("m_AlwaysIncludedShaders");
        alwaysIncluded.arraySize = 0;

        #if ENV_SEARCH_FOR_SHADERS
        Resources.LoadAll("", typeof(Shader));
        System.Collections.Generic.List<Shader> foundShaders = Resources.FindObjectsOfTypeAll<Shader>()
            .Where(s => { string name = s.name.ToLower(); return 0 == (s.hideFlags & HideFlags.DontSave); })
            .GroupBy(s => s.name)
            .Select(g => g.First())
            .ToList();
        #else
        List<Shader> foundShaders = new List<Shader>();
        #endif

        foreach(string shader in ensureTheseShadersAreAvailable.OrderBy(s => s, StringComparer.Ordinal))
        {
            if(foundShaders.Any(s => s.name == shader))
            {
                continue;
            }

            Shader namedShader = Shader.Find(shader);
            if(namedShader != null)
            {
                foundShaders.Add(namedShader);
            }
        }

        foundShaders.Sort((s1, s2) => string.Compare(s1.name, s2.name, StringComparison.Ordinal));

        // populate Resources list of "always included shaders"
        ShaderAssetList alwaysIncludedShaders = AssetDatabase.LoadAssetAtPath<ShaderAssetList>("Assets/Resources/AlwaysIncludedShaders.asset");
        alwaysIncludedShaders.Shaders = new Shader[foundShaders.Count];
        for(int shaderIdx = 0; shaderIdx < foundShaders.Count; ++shaderIdx)
        {
            alwaysIncludedShaders.Shaders[shaderIdx] = foundShaders[shaderIdx];
        }

        EditorUtility.SetDirty(alwaysIncludedShaders);
        #endif

        SerializedProperty preloaded = graphicsManager.FindProperty("m_PreloadedShaders");
        preloaded.ClearArray();
        preloaded.arraySize = 0;

        SerializedProperty spritesDefaultMaterial = graphicsManager.FindProperty("m_SpritesDefaultMaterial");
        spritesDefaultMaterial.objectReferenceValue = Shader.Find("Sprites/Default");

        SerializedProperty renderPipeline = graphicsManager.FindProperty("m_CustomRenderPipeline");
        renderPipeline.objectReferenceValue = null;

        SerializedProperty transparencySortMode = graphicsManager.FindProperty("m_TransparencySortMode");
        transparencySortMode.enumValueIndex = 0;

        SerializedProperty transparencySortAxis = graphicsManager.FindProperty("m_TransparencySortAxis");
        transparencySortAxis.vector3Value = Vector3.forward;

        SerializedProperty defaultRenderingPath = graphicsManager.FindProperty("m_DefaultRenderingPath");
        defaultRenderingPath.intValue = 1;

        SerializedProperty defaultMobileRenderingPath = graphicsManager.FindProperty("m_DefaultMobileRenderingPath");
        defaultMobileRenderingPath.intValue = 1;

        SerializedProperty tierSettings = graphicsManager.FindProperty("m_TierSettings");
        tierSettings.ClearArray();
        tierSettings.arraySize = 0;

        #if ENV_SET_LIGHTMAP
        SerializedProperty lightmapStripping = graphicsManager.FindProperty("m_LightmapStripping");
        lightmapStripping.enumValueIndex = 1;

        SerializedProperty instancingStripping = graphicsManager.FindProperty("m_InstancingStripping");
        instancingStripping.enumValueIndex = 2;

        SerializedProperty lightmapKeepPlain = graphicsManager.FindProperty("m_LightmapKeepPlain");
        lightmapKeepPlain.boolValue = true;

        SerializedProperty lightmapKeepDirCombined = graphicsManager.FindProperty("m_LightmapKeepDirCombined");
        lightmapKeepDirCombined.boolValue = true;

        SerializedProperty lightmapKeepDynamicPlain = graphicsManager.FindProperty("m_LightmapKeepDynamicPlain");
        lightmapKeepDynamicPlain.boolValue = true;

        SerializedProperty lightmapKeepDynamicDirCombined = graphicsManager.FindProperty("m_LightmapKeepDynamicDirCombined");
        lightmapKeepDynamicDirCombined.boolValue = true;

        SerializedProperty lightmapKeepShadowMask = graphicsManager.FindProperty("m_LightmapKeepShadowMask");
        lightmapKeepShadowMask.boolValue = true;

        SerializedProperty lightmapKeepSubtractive = graphicsManager.FindProperty("m_LightmapKeepSubtractive");
        lightmapKeepSubtractive.boolValue = true;
        #endif

        SerializedProperty albedoSwatchInfos = graphicsManager.FindProperty("m_AlbedoSwatchInfos");
        albedoSwatchInfos.ClearArray();
        albedoSwatchInfos.arraySize = 0;

        SerializedProperty lightsUseLinearIntensity = graphicsManager.FindProperty("m_LightsUseLinearIntensity");
        lightsUseLinearIntensity.boolValue = true;

        SerializedProperty lightsUseColorTemperature = graphicsManager.FindProperty("m_LightsUseColorTemperature");
        lightsUseColorTemperature.boolValue = true;

        graphicsManager.ApplyModifiedProperties();
    }

    public static FogSettings GetFogSettings()
    {
        VRC.Core.Logger.Log("Force-enabling Fog", VRC.Core.DebugLevel.All);

        const string graphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(graphicsSettingsAssetPath)[0]);


        SerializedProperty fogStrippingSerializedProperty = graphicsManager.FindProperty("m_FogStripping");
        FogSettings.FogStrippingMode fogStripping = (FogSettings.FogStrippingMode)fogStrippingSerializedProperty.enumValueIndex;

        SerializedProperty fogKeepLinearSerializedProperty = graphicsManager.FindProperty("m_FogKeepLinear");
        bool keepLinear = fogKeepLinearSerializedProperty.boolValue;

        SerializedProperty fogKeepExpSerializedProperty = graphicsManager.FindProperty("m_FogKeepExp");
        bool keepExp = fogKeepExpSerializedProperty.boolValue;

        SerializedProperty fogKeepExp2SerializedProperty = graphicsManager.FindProperty("m_FogKeepExp2");
        bool keepExp2 = fogKeepExp2SerializedProperty.boolValue;

        FogSettings fogSettings = new FogSettings(fogStripping, keepLinear, keepExp, keepExp2);
        return fogSettings;
    }

    public static void SetFogSettings(FogSettings fogSettings)
    {
        VRC.Core.Logger.Log("Force-enabling Fog", VRC.Core.DebugLevel.All);

        const string graphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(graphicsSettingsAssetPath)[0]);

        SerializedProperty fogStripping = graphicsManager.FindProperty("m_FogStripping");
        fogStripping.enumValueIndex = (int)fogSettings.fogStrippingMode;

        SerializedProperty fogKeepLinear = graphicsManager.FindProperty("m_FogKeepLinear");
        fogKeepLinear.boolValue = fogSettings.keepLinear;

        SerializedProperty fogKeepExp = graphicsManager.FindProperty("m_FogKeepExp");
        fogKeepExp.boolValue = fogSettings.keepExp;

        SerializedProperty fogKeepExp2 = graphicsManager.FindProperty("m_FogKeepExp2");
        fogKeepExp2.boolValue = fogSettings.keepExp2;

        graphicsManager.ApplyModifiedProperties();
    }

    private static void SetAudioSettings()
    {
        Object audioManager = AssetDatabase.LoadMainAssetAtPath("ProjectSettings/AudioManager.asset");
        SerializedObject audioManagerSerializedObject = new SerializedObject(audioManager);
        audioManagerSerializedObject.Update();

        SerializedProperty sampleRateSerializedProperty = audioManagerSerializedObject.FindProperty("m_SampleRate");
        sampleRateSerializedProperty.intValue = 48000; // forcing 48k seems to avoid sample rate conversion problems

        SerializedProperty dspBufferSizeSerializedProperty = audioManagerSerializedObject.FindProperty("m_RequestedDSPBufferSize");
        dspBufferSizeSerializedProperty.intValue = 0;
        
        SerializedProperty defaultSpeakerModeSerializedProperty = audioManagerSerializedObject.FindProperty("Default Speaker Mode");
        defaultSpeakerModeSerializedProperty.intValue = 2; // 2 = Stereo

        SerializedProperty virtualVoiceCountSerializedProperty = audioManagerSerializedObject.FindProperty("m_VirtualVoiceCount");
        SerializedProperty realVoiceCountSerializedProperty = audioManagerSerializedObject.FindProperty("m_RealVoiceCount");
        if(EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.Android)
        {
            virtualVoiceCountSerializedProperty.intValue = 32;
            realVoiceCountSerializedProperty.intValue = 24;
        }
        else
        {
            virtualVoiceCountSerializedProperty.intValue = 64;
            realVoiceCountSerializedProperty.intValue = 32;
        }

        audioManagerSerializedObject.ApplyModifiedPropertiesWithoutUndo();
        AssetDatabase.SaveAssets();
    }

    private static void SetPlayerSettings()
    {
        // asset bundles MUST be built with settings that are compatible with VRC client
        #if VRC_OVERRIDE_COLORSPACE_GAMMA
        PlayerSettings.colorSpace = ColorSpace.Gamma;
        #else
        PlayerSettings.colorSpace = ColorSpace.Linear;
        #endif

        #if !VRC_CLIENT // In client rely on platform-switcher
        if (!EditorApplication.isPlaying)
        {
            #pragma warning disable 618
            PlayerSettings.SetVirtualRealitySupported(EditorUserBuildSettings.selectedBuildTargetGroup, true);
            #pragma warning restore 618
        }
        #endif

        PlayerSettings.graphicsJobs = true;

        PlayerSettings.gpuSkinning = true;
        
        #if UNITY_2019_3_OR_NEWER
        PlayerSettings.gcIncremental = true;
        #endif

#if VRC_VR_WAVE
        PlayerSettings.stereoRenderingPath = StereoRenderingPath.MultiPass;     // Need to use Multi-pass on Wave SDK otherwise mirrors break
#else
        PlayerSettings.stereoRenderingPath = StereoRenderingPath.SinglePass;
#endif

#if UNITY_2018_4_OR_NEWER && !UNITY_2019_3_OR_NEWER
        PlayerSettings.scriptingRuntimeVersion = ScriptingRuntimeVersion.Latest;
#endif

#if UNITY_ANDROID
        PlayerSettings.Android.forceSDCardPermission = true;    // Need access to SD card for saving images
        PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;

        if(PlayerSettings.Android.targetArchitectures.HasFlag(AndroidArchitecture.ARM64))
        {
            // Since we need different IL2CPP args we can't build ARM64 with other Architectures.
            PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
            PlayerSettings.SetAdditionalIl2CppArgs("");
        }
        else
        {
            PlayerSettings.SetAdditionalIl2CppArgs("--linker-flags=\"-long-plt\"");
        }

        #if UNITY_2019_3_OR_NEWER
        PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel29;
        #else
        PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel26;
        #endif
#else
        PlayerSettings.SetAdditionalIl2CppArgs("");
#endif

        SetActiveSDKDefines();

        EnableBatching(true);
    }

    public static void SetActiveSDKDefines()
    {
        bool definesChanged = false;
        BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
        List<string> defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(';').ToList();

        Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
        if(assemblies.Any(assembly => assembly.GetType("VRC.Udon.UdonBehaviour") != null))
        {
            if(!defines.Contains("UDON", StringComparer.OrdinalIgnoreCase))
            {
                defines.Add("UDON");
                definesChanged = true;
            }
        }
        else if(defines.Contains("UDON"))
        {
            defines.Remove("UDON");
        }

        if(VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK2))
        {
            if(!defines.Contains("VRC_SDK_VRCSDK2", StringComparer.OrdinalIgnoreCase))
            {
                defines.Add("VRC_SDK_VRCSDK2");
                definesChanged = true;
            }
        }
        else if(defines.Contains("VRC_SDK_VRCSDK2"))
        {
            defines.Remove("VRC_SDK_VRCSDK2");
        }

        if(VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK3))
        {
            if(!defines.Contains("VRC_SDK_VRCSDK3", StringComparer.OrdinalIgnoreCase))
            {
                defines.Add("VRC_SDK_VRCSDK3");
                definesChanged = true;
            }
        }
        else if(defines.Contains("VRC_SDK_VRCSDK3"))
        {
            defines.Remove("VRC_SDK_VRCSDK3");
        }

        if(definesChanged)
        {
            PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, string.Join(";", defines.ToArray()));
        }
    }

    private static void SetBuildTarget()
    {
        #if !VRC_CLIENT
        VRC.Core.Logger.Log("Setting build target", VRC.Core.DebugLevel.All);

        BuildTarget target = UnityEditor.EditorUserBuildSettings.activeBuildTarget;

        if (!allowedBuildtargets.Contains(target))
        {
            Debug.LogError("Target not supported, switching to one that is.");
            target = allowedBuildtargets[0];
            #pragma warning disable CS0618 // Type or member is obsolete
            EditorUserBuildSettings.SwitchActiveBuildTarget(target);
            #pragma warning restore CS0618 // Type or member is obsolete
        }
        #endif
    }

    private static void ConfigureAssets()
    {
#if VRC_CLIENT
        VRC.UI.Client.Editor.VRCUIManagerEditorHelpers.ConfigureNewUIAssets();
#endif
    }

    private static void LoadEditorResources()
    {
        AvatarPerformanceStats.Initialize();
    }

    public readonly struct FogSettings
    {
        public enum FogStrippingMode
        {
            Automatic,
            Custom
        }

        public readonly FogStrippingMode fogStrippingMode;
        public readonly bool keepLinear;
        public readonly bool keepExp;
        public readonly bool keepExp2;

        public FogSettings(FogStrippingMode fogStrippingMode)
        {
            this.fogStrippingMode = fogStrippingMode;
            keepLinear = true;
            keepExp = true;
            keepExp2 = true;
        }

        public FogSettings(FogStrippingMode fogStrippingMode, bool keepLinear, bool keepExp, bool keepExp2)
        {
            this.fogStrippingMode = fogStrippingMode;
            this.keepLinear = keepLinear;
            this.keepExp = keepExp;
            this.keepExp2 = keepExp2;
        }
    }
    
    private static readonly Dictionary<string, object>[] _graphicsPresets = {
        new Dictionary<string, object>
        {
            {"name", "Low"},
            {"pixelLightCount", 4},
            {"shadows", 2},
            {"shadowResolution", 2},
            {"shadowProjection", 1},
            {"shadowCascades", 2},
            {"shadowDistance", 75f},
            {"shadowNearPlaneOffset", 2f},
            {"shadowCascade2Split", 0.33333334},
            {"shadowCascade4Split", new Vector3(0.06666667f, 0.19999999f, 0.46666664f)},
            {"shadowmaskMode", 0},
            {"skinWeights", 4},
            {"textureQuality", 0},
            {"anisotropicTextures", 2},
            {"antiAliasing", 0},
            {"softParticles", true},
            {"softVegetation", true},
            {"realtimeReflectionProbes", true},
            {"billboardsFaceCameraPosition", true},
            {"vSyncCount", 0},
            {"lodBias", 1f},
            {"maximumLODLevel", 0},
            {"streamingMipmapsActive", false},
            {"streamingMipmapsAddAllCameras", true},
            {"streamingMipmapsMemoryBudget", 512f},
            {"streamingMipmapsRenderersPerFrame", 512},
            {"streamingMipmapsMaxLevelReduction", 2},
            {"streamingMipmapsMaxFileIORequests", 1024},
            {"particleRaycastBudget", 1024},
            {"asyncUploadTimeSlice", 2},
            {"asyncUploadBufferSize", 64},
            {"asyncUploadPersistentBuffer", true},
            {"resolutionScalingFixedDPIFactor", 1f},
            {"customRenderPipeline", null},
            {"excludedTargetPlatforms", new[] {"Android"}}
        },
        new Dictionary<string, object>
        {
            {"name", "Medium"},
            {"pixelLightCount", 4},
            {"shadows", 2},
            {"shadowResolution", 2},
            {"shadowProjection", 1},
            {"shadowCascades", 2},
            {"shadowDistance", 75f},
            {"shadowNearPlaneOffset", 2f},
            {"shadowCascade2Split", 0.33333334},
            {"shadowCascade4Split", new Vector3(0.06666667f, 0.19999999f, 0.46666664f)},
            {"shadowmaskMode", 0},
            {"skinWeights", 4},
            {"textureQuality", 0},
            {"anisotropicTextures", 2},
            {"antiAliasing", 4},
            {"softParticles", true},
            {"softVegetation", true},
            {"realtimeReflectionProbes", true},
            {"billboardsFaceCameraPosition", true},
            {"vSyncCount", 0},
            {"lodBias", 1.5f},
            {"maximumLODLevel", 0},
            {"streamingMipmapsActive", false},
            {"streamingMipmapsAddAllCameras", true},
            {"streamingMipmapsMemoryBudget", 512f},
            {"streamingMipmapsRenderersPerFrame", 512},
            {"streamingMipmapsMaxLevelReduction", 2},
            {"streamingMipmapsMaxFileIORequests", 1024},
            {"particleRaycastBudget", 2048},
            {"asyncUploadTimeSlice", 2},
            {"asyncUploadBufferSize", 64},
            {"asyncUploadPersistentBuffer", true},
            {"resolutionScalingFixedDPIFactor", 1f},
            {"customRenderPipeline", null},
            {"excludedTargetPlatforms", new[] {"Android"}}
        },
        new Dictionary<string, object>
        {
            {"name", "High"},
            {"pixelLightCount", 8},
            {"shadows", 2},
            {"shadowResolution", 3},
            {"shadowProjection", 1},
            {"shadowCascades", 2},
            {"shadowDistance", 75f},
            {"shadowNearPlaneOffset", 2f},
            {"shadowCascade2Split", 0.33333334},
            {"shadowCascade4Split", new Vector3(0.06666667f, 0.19999999f, 0.46666664f)},
            {"shadowmaskMode", 0},
            {"skinWeights", 4},
            {"textureQuality", 0},
            {"anisotropicTextures", 2},
            {"antiAliasing", 4},
            {"softParticles", true},
            {"softVegetation", true},
            {"realtimeReflectionProbes", true},
            {"billboardsFaceCameraPosition", true},
            {"vSyncCount", 0},
            {"lodBias", 2f},
            {"maximumLODLevel", 0},
            {"streamingMipmapsActive", false},
            {"streamingMipmapsAddAllCameras", true},
            {"streamingMipmapsMemoryBudget", 512f},
            {"streamingMipmapsRenderersPerFrame", 512},
            {"streamingMipmapsMaxLevelReduction", 2},
            {"streamingMipmapsMaxFileIORequests", 1024},
            {"particleRaycastBudget", 4096},
            {"asyncUploadTimeSlice", 2},
            {"asyncUploadBufferSize", 128},
            {"asyncUploadPersistentBuffer", true},
            {"resolutionScalingFixedDPIFactor", 1f},
            {"customRenderPipeline", null},
            {"excludedTargetPlatforms", new []{"Android"}}
        },
        new Dictionary<string, object>
        {
            {"name", "Ultra"},
            {"pixelLightCount", 8},
            {"shadows", 2},
            {"shadowResolution", 3},
            {"shadowProjection", 1},
            {"shadowCascades", 4},
            {"shadowDistance", 150f},
            {"shadowNearPlaneOffset", 2f},
            {"shadowCascade2Split", 0.33333334},
            {"shadowCascade4Split", new Vector3(0.06666667f, 0.19999999f, 0.46666664f)},
            {"shadowmaskMode", 0},
            {"skinWeights", 4},
            {"textureQuality", 0},
            {"anisotropicTextures", 2},
            {"antiAliasing", 4},
            {"softParticles", true},
            {"softVegetation", true},
            {"realtimeReflectionProbes", true},
            {"billboardsFaceCameraPosition", true},
            {"vSyncCount", 0},
            {"lodBias", 2f},
            {"maximumLODLevel", 0},
            {"streamingMipmapsActive", false},
            {"streamingMipmapsAddAllCameras", true},
            {"streamingMipmapsMemoryBudget", 512f},
            {"streamingMipmapsRenderersPerFrame", 512},
            {"streamingMipmapsMaxLevelReduction", 2},
            {"streamingMipmapsMaxFileIORequests", 1024},
            {"particleRaycastBudget", 4096},
            {"asyncUploadTimeSlice", 2},
            {"asyncUploadBufferSize", 128},
            {"asyncUploadPersistentBuffer", true},
            {"resolutionScalingFixedDPIFactor", 1f},
            {"customRenderPipeline", null},
            {"excludedTargetPlatforms", new[]{"Android"}}
        },
        new Dictionary<string, object>
        {
            {"name", "Mobile"},
            {"pixelLightCount", 4},
            {"shadows", 0},
            {"shadowResolution", 1},
            {"shadowProjection", 1},
            {"shadowCascades", 1},
            {"shadowDistance", 50f},
            {"shadowNearPlaneOffset", 2f},
            {"shadowCascade2Split", 0.33333334},
            {"shadowCascade4Split", new Vector3(0.06666667f, 0.19999999f, 0.46666664f)},
            {"shadowmaskMode", 0},
            {"skinWeights", 4},
            {"textureQuality", 0},
            {"anisotropicTextures", 2},
            {"antiAliasing", 2},
            {"softParticles", false},
            {"softVegetation", false},
            {"realtimeReflectionProbes", false},
            {"billboardsFaceCameraPosition", true},
            {"vSyncCount", 0},
            {"lodBias", 2f},
            {"maximumLODLevel", 0},
            {"streamingMipmapsActive", false},
            {"streamingMipmapsAddAllCameras", true},
            {"streamingMipmapsMemoryBudget", 512f},
            {"streamingMipmapsRenderersPerFrame", 512},
            {"streamingMipmapsMaxLevelReduction", 2},
            {"streamingMipmapsMaxFileIORequests", 1024},
            {"particleRaycastBudget", 1024},
            {"asyncUploadTimeSlice", 1},
            {"asyncUploadBufferSize", 32},
            {"asyncUploadPersistentBuffer", true},
            {"resolutionScalingFixedDPIFactor", 1f},
            {"customRenderPipeline", null},
            {"excludedTargetPlatforms", new []{"Standalone"}}
        }
    };
}