No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RenderPipelineGraphicsSettingsContainer.cs 1.8KB

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