Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

RenderPipelineGlobalSettings

class in UnityEngine.Rendering

/

Inherits from:ScriptableObject

/

Implemented in:UnityEngine.CoreModule


Implements interfaces:ISerializationCallbackReceiver

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A ScriptableObject to associate with a RenderPipeline and store project-wide settings for that Pipeline.

A single RenderPipelineGlobalSettings instance can be registered to the GraphicsSettings via GraphicsSettings.RegisterRenderPipelineSettings. We recommend to use this ScriptableObject to save RenderPipeline settings you would find in the GraphicsSettings.

using System;
using System.Collections.Generic;

using UnityEngine; using UnityEngine.Rendering;

#if UNITY_EDITOR using UnityEditor.Rendering; #endif

public class ExampleRenderPipelineAsset : RenderPipelineAsset { protected override RenderPipeline CreatePipeline() { return new ExampleRenderPipeline(); } }

public class ExampleRenderPipeline : RenderPipeline { public virtual RenderPipelineGlobalSettings globalSettings => ExampleRPGlobalSettings.instance;

protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras) { #if UNITY_EDITOR // On Editor we must make sure the Global Settings Asset is registered into the GraphicsSettings // Graphics Settings will make sure the asset is available on player builds if (globalSettings == null) { var mySettings = ExampleRPGlobalSettings.Create(); ExampleRPGlobalSettings.RegisterToGraphicsSettings(mySettings); } #endif

// Do something } }

[SupportedOnRenderPipeline(typeof(ExampleRenderPipelineAsset))] public class ExampleRPGlobalSettings : RenderPipelineGlobalSettings { private static ExampleRPGlobalSettings cachedInstance = null; public static ExampleRPGlobalSettings instance { get { if (cachedInstance == null) cachedInstance = GraphicsSettings.GetSettingsForRenderPipeline<ExampleRenderPipeline>() as ExampleRPGlobalSettings; return cachedInstance; } }

/* Use this pattern if you want to enable your global settings to use IRenderPipelineGraphicsSettings

[SerializeReference] private List<IRenderPipelineGraphicsSettings> m_SettingsList = new(); protected override List<IRenderPipelineGraphicsSettings> settingsList => m_Settings;

*/

#if UNITY_EDITOR public static void RegisterToGraphicsSettings(ExampleRPGlobalSettings newSettings) { EditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset<ExampleRenderPipeline>(newSettings as RenderPipelineGlobalSettings); cachedInstance = null; }

public static void UnregisterToGraphicsSettings() { EditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset<ExampleRenderPipeline>(null); cachedInstance = null; }

static public ExampleRPGlobalSettings Create() { ExampleRPGlobalSettings assetCreated = ScriptableObject.CreateInstance<ExampleRPGlobalSettings>(); return assetCreated; } #endif }

Properties

settingsListExposes a List<IRenderPipelineGraphicsSettings> that this RenderPipelineGlobalSettings instance is managing.

Public Methods

InitializeEditor-only function that initializes the RenderPipelineGlobalSettings.

Protected Methods

AddAdds a IRenderPipelineGraphicsSettings interface to this instance of the RenderPipelineGlobalSettings asset.
ContainsIf the given ISRPGraphicsSetting type is present in this RenderPipelineGlobalSettings instance.
GetSettingsImplementingInterfaceGet all settings for the currently active pipeline that implement TSettingsInterfaceType.
RemoveRemoves a IRenderPipelineGraphicsSettings interface from this instance of the RenderPipelineGlobalSettings asset.
TryGetLooks for a IRenderPipelineGraphicsSettings interface in this instance of the RenderPipelineGlobalSettings asset and returns true if it's found.
TryGetFirstSettingsImplementingInterfaceTry to get the first settings that implements TSettingsInterfaceType.

Inherited Members

Properties

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static Methods

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.
CreateInstanceCreates an instance of a scriptable object.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

Messages

AwakeCalled when an instance of ScriptableObject is created.
OnDestroyThis function is called when the scriptable object will be destroyed.
OnDisableThis function is called when the scriptable object goes out of scope.
OnEnableThis function is called when the object is loaded.
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
ResetReset to default values.