A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections.Generic;
3
4#if UNITY_EDITOR
5using UnityEditor;
6#endif
7
8namespace UnityEngine.Rendering
9{
10 /// <summary>
11 /// Contains a double list of <see cref="IRenderPipelineGraphicsSettings"/> one is used for editor
12 /// and the other for standalone release, the standalone release will be stripped by <see cref="IRenderPipelineGraphicsSettingsStripper{T}"/>
13 /// </summary>
14 [Serializable]
15 public class RenderPipelineGraphicsSettingsContainer : ISerializationCallbackReceiver
16 {
17#if UNITY_EDITOR
18 [SerializeField] private RenderPipelineGraphicsSettingsCollection m_SettingsList = new();
19#endif
20
21 [SerializeField, HideInInspector] private RenderPipelineGraphicsSettingsCollection m_RuntimeSettings = new();
22
23 /// <summary>
24 /// Returns one list for editor and another for runtime
25 /// </summary>
26 public List<IRenderPipelineGraphicsSettings> settingsList
27 {
28#if UNITY_EDITOR
29 get => m_SettingsList.settingsList;
30#else
31 get => m_RuntimeSettings.settingsList;
32#endif
33 }
34
35 /// <summary>
36 /// On Before Serialize callback where the stripping is performed
37 /// </summary>
38 public void OnBeforeSerialize()
39 {
40#if UNITY_EDITOR
41 m_RuntimeSettings.settingsList.Clear();
42 if (BuildPipeline.isBuildingPlayer) // Same behaviour as transfer.IsSerializingForGameRelease
43 RenderPipelineGraphicsSettingsStripper.PerformStripping(m_SettingsList.settingsList, m_RuntimeSettings.settingsList);
44#endif
45 }
46
47 /// <summary>
48 /// On After Deserialize callback, nothing is implemented
49 /// </summary>
50 public void OnAfterDeserialize()
51 {
52#if UNITY_EDITOR
53 m_RuntimeSettings.settingsList.Clear();
54#endif
55 }
56 }
57}