void DrawAssetSelection(ref SerializedUniversalRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); var newAsset = (UniversalRenderPipelineGlobalSettings)EditorGUILayout.ObjectField(settingsSerialized, typeof(UniversalRenderPipelineGlobalSettings), false); if (EditorGUI.EndChangeCheck()) { UniversalRenderPipelineGlobalSettings.UpdateGraphicsSettings(newAsset); if (settingsSerialized != null && !settingsSerialized.Equals(null)) { EditorUtility.SetDirty(settingsSerialized); } } if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a URP Global Settings asset in the Assets folder."), GUILayout.Width(45), GUILayout.Height(18))) { UniversalGlobalSettingsCreator.Create(activateAsset: true); } bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && (settingsSerialized != null); if (GUILayout.Button(EditorGUIUtility.TrTextContent("Clone", "Clone a URP Global Settings asset in the Assets folder."), GUILayout.Width(45), GUILayout.Height(18))) { UniversalGlobalSettingsCreator.Clone(settingsSerialized, activateAsset: true); } GUI.enabled = guiEnabled; } EditorGUIUtility.labelWidth = oldWidth; EditorGUILayout.Space(); }
void DrawAssetSelection(ref SerializedUniversalRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); var newAsset = (UniversalRenderPipelineGlobalSettings)EditorGUILayout.ObjectField(settingsSerialized, typeof(UniversalRenderPipelineGlobalSettings), false); if (EditorGUI.EndChangeCheck()) { UniversalRenderPipelineGlobalSettings.UpdateGraphicsSettings(newAsset); Debug.Assert(newAsset == UniversalRenderPipelineGlobalSettings.instance); if (settingsSerialized != null && !settingsSerialized.Equals(null)) { EditorUtility.SetDirty(settingsSerialized); } } if (GUILayout.Button(Styles.newAssetButtonLabel, GUILayout.Width(45), GUILayout.Height(18))) { UniversalGlobalSettingsCreator.Create(useProjectSettingsFolder: true, activateAsset: true); } bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && (settingsSerialized != null); if (GUILayout.Button(Styles.cloneAssetButtonLabel, GUILayout.Width(45), GUILayout.Height(18))) { UniversalGlobalSettingsCreator.Clone(settingsSerialized, activateAsset: true); } GUI.enabled = guiEnabled; } EditorGUIUtility.labelWidth = oldWidth; EditorGUILayout.Space(); }
protected override void Create(bool useProjectSettingsFolder, bool activateAsset) { UniversalGlobalSettingsCreator.Create(useProjectSettingsFolder: true, activateAsset: true); }
protected override void Clone(RenderPipelineGlobalSettings src, bool activateAsset) { UniversalGlobalSettingsCreator.Clone(src as UniversalRenderPipelineGlobalSettings, activateAsset: activateAsset); }