Class CoreUtils
Set of utility functions for the Core Scriptable Render Pipeline Library
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public static class CoreUtils
Fields
assetCreateMenuPriority1
Asset Create Menu priority 1
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int assetCreateMenuPriority1 = 230
Field Value
| Type | Description |
|---|---|
| int |
assetCreateMenuPriority2
Asset Create Menu priority 2
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int assetCreateMenuPriority2 = 241
Field Value
| Type | Description |
|---|---|
| int |
assetCreateMenuPriority3
Asset Create Menu priority 3
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int assetCreateMenuPriority3 = 300
Field Value
| Type | Description |
|---|---|
| int |
editMenuPriority1
Edit Menu priority 1
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int editMenuPriority1 = 320
Field Value
| Type | Description |
|---|---|
| int |
editMenuPriority2
Edit Menu priority 2
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int editMenuPriority2 = 331
Field Value
| Type | Description |
|---|---|
| int |
editMenuPriority3
Edit Menu priority 3
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int editMenuPriority3 = 342
Field Value
| Type | Description |
|---|---|
| int |
editMenuPriority4
Edit Menu priority 4
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int editMenuPriority4 = 353
Field Value
| Type | Description |
|---|---|
| int |
gameObjectMenuPriority
Game Object Menu priority
Declaration
[Obsolete("Use CoreUtils.Priorities instead. #from(2021.2)")]
public const int gameObjectMenuPriority = 10
Field Value
| Type | Description |
|---|---|
| int |
lookAtList
List of look at matrices for cubemap faces. Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204881(v=vs.85).aspx
Declaration
public static readonly Vector3[] lookAtList
Field Value
| Type | Description |
|---|---|
| Vector3[] |
upVectorList
List of up vectors for cubemap faces. Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204881(v=vs.85).aspx
Declaration
public static readonly Vector3[] upVectorList
Field Value
| Type | Description |
|---|---|
| Vector3[] |
Properties
blackCubeTexture
Black cubemap texture.
Declaration
public static Cubemap blackCubeTexture { get; }
Property Value
| Type | Description |
|---|---|
| Cubemap |
blackVolumeTexture
Black 3D texture.
Declaration
public static Texture3D blackVolumeTexture { get; }
Property Value
| Type | Description |
|---|---|
| Texture3D |
emptyBuffer
Empty 4-Byte buffer resource usable as a dummy.
Declaration
public static GraphicsBuffer emptyBuffer { get; }
Property Value
| Type | Description |
|---|---|
| GraphicsBuffer |
emptyUAV
Empty 1x1 texture usable as a dummy UAV.
Declaration
public static RenderTexture emptyUAV { get; }
Property Value
| Type | Description |
|---|---|
| RenderTexture |
magentaCubeTexture
Magenta cubemap texture.
Declaration
public static Cubemap magentaCubeTexture { get; }
Property Value
| Type | Description |
|---|---|
| Cubemap |
magentaCubeTextureArray
Black cubemap array texture.
Declaration
public static CubemapArray magentaCubeTextureArray { get; }
Property Value
| Type | Description |
|---|---|
| CubemapArray |
whiteCubeTexture
White cubemap texture.
Declaration
public static Cubemap whiteCubeTexture { get; }
Property Value
| Type | Description |
|---|---|
| Cubemap |
Methods
AreAnimatedMaterialsEnabled(Camera)
Returns true if "Animated Materials" are enabled for the view associated with the given camera.
Declaration
public static bool AreAnimatedMaterialsEnabled(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | Input camera. |
Returns
| Type | Description |
|---|---|
| bool | True if "Animated Materials" are enabled for the view associated with the given camera. |
ArePostProcessesEnabled(Camera)
Returns true if "Post Processes" are enabled for the view associated with the given camera.
Declaration
public static bool ArePostProcessesEnabled(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | Input camera. |
Returns
| Type | Description |
|---|---|
| bool | True if "Post Processes" are enabled for the view associated with the given camera. |
CalculateViewSpaceCorners(Matrix4x4, float)
Calcualte frustum corners at specified camera depth given projection matrix and depth z.
Declaration
public static Vector3[] CalculateViewSpaceCorners(Matrix4x4 proj, float z)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | proj | Projection matrix used by the view frustrum. |
| float | z | Z-depth from the camera origin at which the corners will be calculated. |
Returns
| Type | Description |
|---|---|
| Vector3[] | Return conner vectors for left-bottom, right-bottm, right-top, left-top in view space. |
ClearCubemap(CommandBuffer, RenderTexture, Color, bool)
Clear a cubemap render texture.
Declaration
public static void ClearCubemap(CommandBuffer cmd, RenderTexture renderTexture, Color clearColor, bool clearMips = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTexture | renderTexture | Cubemap render texture that needs to be cleared. |
| Color | clearColor | Color used for clearing. |
| bool | clearMips | Set to true to clear the mip maps of the render texture. |
ClearRenderTarget(CommandBuffer, ClearFlag, Color)
Clear the currently bound render texture.
Declaration
public static void ClearRenderTarget(CommandBuffer cmd, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| ClearFlag | clearFlag | Specify how the render texture should be cleared. |
| Color | clearColor | Specify with which color the render texture should be cleared. |
ConvertLinearToActiveColorSpace(Color)
Converts the provided linear color to the current active color space.
Declaration
public static Color ConvertLinearToActiveColorSpace(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | Input color. |
Returns
| Type | Description |
|---|---|
| Color | sRGB color if the active color space is ColorSpace.Gamma, the original input otherwise. |
ConvertSRGBToActiveColorSpace(Color)
Converts the provided sRGB color to the current active color space.
Declaration
public static Color ConvertSRGBToActiveColorSpace(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | Input color. |
Returns
| Type | Description |
|---|---|
| Color | Linear color if the active color space is ColorSpace.Linear, the original input otherwise. |
CreateCubeMesh(Vector3, Vector3)
Creates a cube mesh.
Declaration
public static Mesh CreateCubeMesh(Vector3 min, Vector3 max)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | min | Minimum corner coordinates in local space. |
| Vector3 | max | Maximum corner coordinates in local space. |
Returns
| Type | Description |
|---|---|
| Mesh | A new instance of a cube Mesh. |
CreateEngineMaterial(string)
Creates a Material with the provided shader path. hideFlags will be set to HideFlags.HideAndDontSave.
Declaration
public static Material CreateEngineMaterial(string shaderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | shaderPath | Path of the shader used for the material. |
Returns
| Type | Description |
|---|---|
| Material | A new Material instance using the shader found at the provided path. |
CreateEngineMaterial(Shader)
Creates a Material with the provided shader. hideFlags will be set to HideFlags.HideAndDontSave.
Declaration
public static Material CreateEngineMaterial(Shader shader)
Parameters
| Type | Name | Description |
|---|---|---|
| Shader | shader | Shader used for the material. |
Returns
| Type | Description |
|---|---|
| Material | A new Material instance using the provided shader. |
Destroy(Object)
Destroys a UnityObject safely.
Declaration
public static void Destroy(Object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | Object to be destroyed. |
DivRoundUp(int, int)
Divides one value by another and rounds up to the next integer. This is often used to calculate dispatch dimensions for compute shaders.
Declaration
public static int DivRoundUp(int value, int divisor)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The value to divide. |
| int | divisor | The value to divide by. |
Returns
| Type | Description |
|---|---|
| int | The value divided by the divisor rounded up to the next integer. |
DrawFullScreen(CommandBuffer, Material, MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | CommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier colorBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | CommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| RenderTargetIdentifier | colorBuffer | RenderTargetIdentifier of the color buffer that needs to be set before drawing the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, RenderTargetIdentifier, MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | CommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| RenderTargetIdentifier | colorBuffer | RenderTargetIdentifier of the color buffer that needs to be set before drawing the full screen triangle. |
| RenderTargetIdentifier | depthStencilBuffer | RenderTargetIdentifier of the depth buffer that needs to be set before drawing the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier[] colorBuffers, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | CommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color buffers that needs to be set before drawing the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], RenderTargetIdentifier, MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | commandBuffer | CommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color buffers that needs to be set before drawing the full screen triangle. |
| RenderTargetIdentifier | depthStencilBuffer | RenderTargetIdentifier of the depth buffer that needs to be set before drawing the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawFullScreen(RasterCommandBuffer, Material, MaterialPropertyBlock, int)
Draws a full screen triangle.
Declaration
public static void DrawFullScreen(RasterCommandBuffer commandBuffer, Material material, MaterialPropertyBlock properties = null, int shaderPassId = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| RasterCommandBuffer | commandBuffer | RasterCommandBuffer used for rendering commands. |
| Material | material | Material used on the full screen triangle. |
| MaterialPropertyBlock | properties | Optional material property block for the provided material. |
| int | shaderPassId | Index of the material pass. |
DrawRendererList(CommandBuffer, RendererList)
Draw a renderer list.
Declaration
public static void DrawRendererList(CommandBuffer cmd, RendererList rendererList)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Command Buffer used for rendering. |
| RendererList | rendererList | Renderer List to render. |
DrawRendererList(IRasterCommandBuffer, RendererList)
Draw a renderer list.
Declaration
public static void DrawRendererList(IRasterCommandBuffer cmd, RendererList rendererList)
Parameters
| Type | Name | Description |
|---|---|---|
| IRasterCommandBuffer | cmd | Command Buffer used for rendering. |
| RendererList | rendererList | Renderer List to render. |
DrawRendererList(ScriptableRenderContext, CommandBuffer, RendererList)
Draw a renderer list.
Declaration
[Obsolete("Use DrawRendererList(CommandBuffer cmd, UnityEngine.Rendering.RendererList rendererList) instead. #from(6000.3) (UnityUpgradable) -> !0")]
public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderContext | renderContext | Current Scriptable Render Context. |
| CommandBuffer | cmd | Command Buffer used for rendering. |
| RendererList | rendererList | Renderer List to render. |
EnsureFolderTreeInAssetFilePath(string)
Create any missing folders in the file path given.
Declaration
public static void EnsureFolderTreeInAssetFilePath(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | File or folder (ending with '/') path to ensure existence of each subfolder in. |
GetAllAssemblyTypes()
Returns all assembly types.
Declaration
public static IEnumerable<Type> GetAllAssemblyTypes()
Returns
| Type | Description |
|---|---|
| IEnumerable<Type> | The list of all assembly types of the current domain. |
GetAllTypesDerivedFrom<T>()
Returns a list of types that inherit from the provided type.
Declaration
public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()
Returns
| Type | Description |
|---|---|
| IEnumerable<Type> | A list of types that inherit from the provided type. |
Type Parameters
| Name | Description |
|---|---|
| T | Parent Type |
GetDefaultDepthBufferBits()
Return the number of DepthStencil RenderTarget depth bits preferred for the current platform.
Declaration
public static DepthBits GetDefaultDepthBufferBits()
Returns
| Type | Description |
|---|---|
| DepthBits | The number of DepthStencil RenderTarget depth bits preferred for the current platform. |
GetDefaultDepthOnlyFormat()
Return the GraphicsFormat of Depth-only RenderTarget preferred for the current platform.
Declaration
public static GraphicsFormat GetDefaultDepthOnlyFormat()
Returns
| Type | Description |
|---|---|
| GraphicsFormat | The GraphicsFormat of Depth-only RenderTarget preferred for the current platform. |
GetDefaultDepthStencilFormat()
Return the GraphicsFormat of DepthStencil RenderTarget preferred for the current platform.
Declaration
public static GraphicsFormat GetDefaultDepthStencilFormat()
Returns
| Type | Description |
|---|---|
| GraphicsFormat | The GraphicsFormat of DepthStencil RenderTarget preferred for the current platform. |
GetIconForType<T>()
Returns the icon for the given type if it has an IconAttribute.
Declaration
public static Texture2D GetIconForType<T>() where T : Object
Returns
| Type | Description |
|---|---|
| Texture2D | Valid icon texture, or null none is found |
Type Parameters
| Name | Description |
|---|---|
| T | Type parameter |
GetLastEnumValue<T>()
Get the last declared value from an enum Type
Declaration
public static T GetLastEnumValue<T>() where T : Enum
Returns
| Type | Description |
|---|---|
| T | Last value of the enum |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum |
GetMipCount(int)
Gets the Mip Count for a given size
Declaration
public static int GetMipCount(int size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | size | The size to obtain the mip count |
Returns
| Type | Description |
|---|---|
| int | The mip count |
GetMipCount(float)
Gets the Mip Count for a given size
Declaration
public static int GetMipCount(float size)
Parameters
| Type | Name | Description |
|---|---|---|
| float | size | The size to obtain the mip count |
Returns
| Type | Description |
|---|---|
| int | The mip count |
GetRenderTargetAutoName(int, int, int, GraphicsFormat, string, bool, bool, MSAASamples)
Generate a name based on render texture parameters.
Declaration
public static string GetRenderTargetAutoName(int width, int height, int depth, GraphicsFormat format, string name, bool mips = false, bool enableMSAA = false, MSAASamples msaaSamples = MSAASamples.None)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | With of the texture. |
| int | height | Height of the texture. |
| int | depth | Depth of the texture. |
| GraphicsFormat | format | Graphics format of the render texture. |
| string | name | Base name of the texture. |
| bool | mips | True if the texture has mip maps. |
| bool | enableMSAA | True if the texture is multisampled. |
| MSAASamples | msaaSamples | Number of MSAA samples. |
Returns
| Type | Description |
|---|---|
| string | Generated names bassed on the provided parameters. |
GetRenderTargetAutoName(int, int, int, GraphicsFormat, TextureDimension, string, bool, bool, MSAASamples, bool, bool)
Generate a name based on render texture parameters.
Declaration
public static string GetRenderTargetAutoName(int width, int height, int depth, GraphicsFormat format, TextureDimension dim, string name, bool mips = false, bool enableMSAA = false, MSAASamples msaaSamples = MSAASamples.None, bool dynamicRes = false, bool dynamicResExplicit = false)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | With of the texture. |
| int | height | Height of the texture. |
| int | depth | Depth of the texture. |
| GraphicsFormat | format | Graphics format of the render texture. |
| TextureDimension | dim | Dimension of the texture. |
| string | name | Base name of the texture. |
| bool | mips | True if the texture has mip maps. |
| bool | enableMSAA | True if the texture is multisampled. |
| MSAASamples | msaaSamples | Number of MSAA samples. |
| bool | dynamicRes | True if the texture uses dynamic resolution. |
| bool | dynamicResExplicit | True if the texture uses dynamic resolution with explicit resize control. |
Returns
| Type | Description |
|---|---|
| string | Generated names bassed on the provided parameters. |
GetRenderTargetAutoName(int, int, int, RenderTextureFormat, string, bool, bool, MSAASamples)
Generate a name based on render texture parameters.
Declaration
public static string GetRenderTargetAutoName(int width, int height, int depth, RenderTextureFormat format, string name, bool mips = false, bool enableMSAA = false, MSAASamples msaaSamples = MSAASamples.None)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | With of the texture. |
| int | height | Height of the texture. |
| int | depth | Depth of the texture. |
| RenderTextureFormat | format | Format of the render texture. |
| string | name | Base name of the texture. |
| bool | mips | True if the texture has mip maps. |
| bool | enableMSAA | True if the texture is multisampled. |
| MSAASamples | msaaSamples | Number of MSAA samples. |
Returns
| Type | Description |
|---|---|
| string | Generated names bassed on the provided parameters. |
GetTextureAutoName(int, int, GraphicsFormat, TextureDimension, string, bool, int)
Generate a name based on texture parameters.
Declaration
public static string GetTextureAutoName(int width, int height, GraphicsFormat format, TextureDimension dim = TextureDimension.None, string name = "", bool mips = false, int depth = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | With of the texture. |
| int | height | Height of the texture. |
| GraphicsFormat | format | Graphics format of the texture. |
| TextureDimension | dim | Dimension of the texture. |
| string | name | Base name of the texture. |
| bool | mips | True if the texture has mip maps. |
| int | depth | Depth of the texture. |
Returns
| Type | Description |
|---|---|
| string | Generated names based on the provided parameters. |
GetTextureAutoName(int, int, TextureFormat, TextureDimension, string, bool, int)
Generate a name based on texture parameters.
Declaration
public static string GetTextureAutoName(int width, int height, TextureFormat format, TextureDimension dim = TextureDimension.None, string name = "", bool mips = false, int depth = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | With of the texture. |
| int | height | Height of the texture. |
| TextureFormat | format | Format of the texture. |
| TextureDimension | dim | Dimension of the texture. |
| string | name | Base name of the texture. |
| bool | mips | True if the texture has mip maps. |
| int | depth | Depth of the texture. |
Returns
| Type | Description |
|---|---|
| string | Generated names based on the provided parameters. |
GetTextureHash(Texture)
Compute a hash of texture properties.
Declaration
public static int GetTextureHash(Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | Source texture. |
Returns
| Type | Description |
|---|---|
| int | Returns hash of texture properties. |
HasFlag<T>(T, T)
Bitfield flag test.
Declaration
public static bool HasFlag<T>(T mask, T flag) where T : IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| T | mask | Bitfield to test the flag against. |
| T | flag | Flag to be tested against the provided mask. |
Returns
| Type | Description |
|---|---|
| bool | True if the flag is present in the mask. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum flag. |
IsLightOverlapDebugEnabled(Camera)
Returns true if the "Light Overlap" scene view draw mode is enabled.
Declaration
public static bool IsLightOverlapDebugEnabled(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | Input camera. |
Returns
| Type | Description |
|---|---|
| bool | True if "Light Overlap" is enabled in the scene view associated with the input camera. |
IsSceneFilteringEnabled()
Returns true if any Scene view is using the Scene filtering.
Declaration
public static bool IsSceneFilteringEnabled()
Returns
| Type | Description |
|---|---|
| bool | True if any Scene view is using the Scene filtering. |
IsSceneLightingDisabled(Camera)
Returns true if "Scene Lighting" is enabled for the view associated with the given camera.
Declaration
public static bool IsSceneLightingDisabled(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | Input camera. |
Returns
| Type | Description |
|---|---|
| bool | True if "Scene Lighting" is enabled for the view associated with the given camera. |
IsSceneViewFogEnabled(Camera)
Returns true if "Fog" is enabled for the view associated with the given camera.
Declaration
public static bool IsSceneViewFogEnabled(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | Input camera. |
Returns
| Type | Description |
|---|---|
| bool | True if "Fog" is enabled for the view associated with the given camera. |
IsSceneViewPrefabStageContextHidden()
Returns true if the currently opened prefab stage context is set to Hidden.
Declaration
public static bool IsSceneViewPrefabStageContextHidden()
Returns
| Type | Description |
|---|---|
| bool | True if the currently opened prefab stage context is set to Hidden. |
LoadAllAssets<T>(string, bool)
Declaration
public static IEnumerable<T> LoadAllAssets<T>(string extension = "asset", bool allowSubTypes = true) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| string | extension | |
| bool | allowSubTypes |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
PopulateNullFieldsFrom<T>(T, T)
Populates null fields or collection elements in a target object from a source object of the same type.
Declaration
public static void PopulateNullFieldsFrom<T>(T source, T target) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| T | source | The source object from which to copy field values or collection elements. This cannot be null. |
| T | target | The target object to populate with values from the source object. This cannot be null. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the objects. This must be a reference type ( |
Remarks
This method copies non-null field values or collection elements from the source object to the target object.
Both objects must be of the same type, and derived or base types are not allowed. Fields are updated only if they
are null in the target. If a field is a collection implementing IList, the method attempts to copy elements that
are null in the target collection.
Type restrictions:
Tmust be a reference type.sourceandtargetmust be of the exact same type, not derived or base types.- Collections must implement
IListand have the same length in both source and target for element-by-element copying.
PreviousPowerOfTwo(int)
Branchless previous power of two.
Declaration
public static int PreviousPowerOfTwo(int size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | size | Starting size or number. |
Returns
| Type | Description |
|---|---|
| int | Previous power of two. |
SafeRelease(ComputeBuffer)
Safely release a Compute Buffer.
Declaration
public static void SafeRelease(ComputeBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputeBuffer | buffer | Compute Buffer that needs to be released. |
SafeRelease(GraphicsBuffer)
Safely release a Graphics Buffer.
Declaration
public static void SafeRelease(GraphicsBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsBuffer | buffer | Graphics Buffer that needs to be released. |
SetKeyword(ComputeShader, string, bool)
Set a keyword immediately on a compute shader
Declaration
public static void SetKeyword(ComputeShader cs, string keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputeShader | cs | Compute Shader on which to set the keyword. |
| string | keyword | Keyword to be set. |
| bool | state | Value of the keyword to be set. |
SetKeyword(Material, string, bool)
Set a keyword immediately on a Material.
Declaration
public static void SetKeyword(Material material, string keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | material | Material on which to set the keyword. |
| string | keyword | Keyword to set on the material. |
| bool | state | Value of the keyword to set on the material. |
SetKeyword(Material, LocalKeyword, bool)
Set a keyword immediately on a Material.
Declaration
public static void SetKeyword(Material material, LocalKeyword keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | material | Material on which to set the keyword. |
| LocalKeyword | keyword | Keyword to set on the material. |
| bool | state | Value of the keyword to set on the material. |
SetKeyword(BaseCommandBuffer, string, bool)
Set a global keyword using a RasterCommandBuffer
Declaration
public static void SetKeyword(BaseCommandBuffer cmd, string keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseCommandBuffer | cmd | CommandBuffer on which to set the global keyword. |
| string | keyword | Keyword to be set. |
| bool | state | Value of the keyword to be set. |
SetKeyword(CommandBuffer, string, bool)
Set a global keyword using a CommandBuffer
Declaration
public static void SetKeyword(CommandBuffer cmd, string keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer on which to set the global keyword. |
| string | keyword | Keyword to be set. |
| bool | state | Value of the keyword to be set. |
SetKeyword(CommandBuffer, ComputeShader, string, bool)
Set a local keyword on a ComputeShader using a CommandBuffer
Declaration
public static void SetKeyword(CommandBuffer cmd, ComputeShader cs, string keyword, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer on which to set the global keyword. |
| ComputeShader | cs | Compute Shader on which to set the keyword. |
| string | keyword | Keyword to be set. |
| bool | state | Value of the keyword to be set. |
SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle buffer, ClearFlag clearFlag = ClearFlag.None, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands |
| RTHandle | buffer | Color buffer RTHandle |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, Color, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle buffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands |
| RTHandle | buffer | Color buffer RTHandle |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, RTHandle, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands |
| RTHandle | colorBuffer | Color buffer RTHandle |
| RTHandle | depthBuffer | Depth buffer RTHandle |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands |
| RTHandle | colorBuffer | Color buffer RTHandle |
| RTHandle | depthBuffer | Depth buffer RTHandle |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, Color, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands |
| RTHandle | colorBuffer | Color buffer RTHandle |
| RTHandle | depthBuffer | Depth buffer RTHandle |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RTHandle | buffer | Color buffer RTHandleRTR. |
| RenderBufferLoadAction | loadAction | Load action. |
| RenderBufferStoreAction | storeAction | Store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RTHandle, RenderBufferLoadAction, RenderBufferStoreAction, RTHandle, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RTHandle depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RTHandle | colorBuffer | Color buffer RTHandle. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RTHandle | depthBuffer | Depth buffer RTHandle. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, ClearFlag clearFlag = ClearFlag.None, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | RenderTargetIdentifier of the render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | RenderTargetIdentifier of the render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | loadAction | Load action. |
| RenderBufferStoreAction | storeAction | Store action. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | loadAction | Load action. |
| RenderBufferStoreAction | storeAction | Store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | loadAction | Load action. |
| RenderBufferStoreAction | storeAction | Store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | loadAction | Load action. |
| RenderBufferStoreAction | storeAction | Store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | buffer | RenderTargetIdentifier of the render texture. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RenderTargetIdentifier | depthBuffer | Depth buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RenderTargetIdentifier | depthBuffer | Depth buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RenderTargetIdentifier | depthBuffer | Depth buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | Color buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | colorLoadAction | Color buffer load action. |
| RenderBufferStoreAction | colorStoreAction | Color buffer store action. |
| RenderTargetIdentifier | depthBuffer | Depth buffer RenderTargetIdentifier. |
| RenderBufferLoadAction | depthLoadAction | Depth buffer load action. |
| RenderBufferStoreAction | depthStoreAction | Depth buffer store action. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | RenderTargetIdentifier of the color render texture. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | RenderTargetIdentifier of the color render texture. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, Color, int, CubemapFace, int)
Set the current render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | colorBuffer | RenderTargetIdentifier of the color render texture. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RTHandle | depthBuffer | Depth Buffer RTHandle. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer, ClearFlag clearFlag = ClearFlag.None)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RTHandle | depthBuffer | Depth Buffer RTHandle. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag, Color)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RTHandle | depthBuffer | Depth Buffer RTHandle. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag = ClearFlag.None)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag, Color)
Set the current multiple render texture.
Declaration
public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier[] | colorBuffers | RenderTargetIdentifier array of the color render textures. |
| RenderTargetIdentifier | depthBuffer | RenderTargetIdentifier of the depth render texture. |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
SetRenderTarget(ComputeCommandBuffer, RTHandle, ClearFlag, Color, int, CubemapFace, int)
Setup the current render texture using an RTHandle
Declaration
public static void SetRenderTarget(ComputeCommandBuffer cmd, RTHandle buffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown, int depthSlice = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputeCommandBuffer | cmd | ComputeCommandBuffer used for rendering commands, it must not be async. |
| RTHandle | buffer | Color buffer RTHandle |
| ClearFlag | clearFlag | If not set to ClearFlag.None, specifies how to clear the render target after setup. |
| Color | clearColor | If applicable, color with which to clear the render texture after setup. |
| int | miplevel | Mip level that should be bound as a render texture if applicable. |
| CubemapFace | cubemapFace | Cubemap face that should be bound as a render texture if applicable. |
| int | depthSlice | Depth slice that should be bound as a render texture if applicable. |
SetShadingRateCombiner(CommandBuffer, ShadingRateCombinerStage, ShadingRateCombiner)
Set the current shading rate combiner
Declaration
public static void SetShadingRateCombiner(CommandBuffer cmd, ShadingRateCombinerStage stage, ShadingRateCombiner combiner)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| ShadingRateCombinerStage | stage | Combiner stage to set |
| ShadingRateCombiner | combiner | Combiner to set |
SetShadingRateFragmentSize(CommandBuffer, ShadingRateFragmentSize)
Set the current shading rate fragment size
Declaration
public static void SetShadingRateFragmentSize(CommandBuffer cmd, ShadingRateFragmentSize baseShadingRateFragmentSize)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| ShadingRateFragmentSize | baseShadingRateFragmentSize | Shading rate fragment size to set |
SetShadingRateImage(CommandBuffer, in RenderTargetIdentifier)
Set the current shading rate image
Declaration
public static void SetShadingRateImage(CommandBuffer cmd, in RenderTargetIdentifier shadingRateImage)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RenderTargetIdentifier | shadingRateImage | Shading rate image render target identifier to set |
SetViewport(CommandBuffer, RTHandle)
Setup the viewport to the size of the provided RTHandle.
Declaration
public static void SetViewport(CommandBuffer cmd, RTHandle target)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer used for rendering commands. |
| RTHandle | target | RTHandle from which to compute the proper viewport. |
Swap<T>(ref T, ref T)
Swaps two values.
Declaration
public static void Swap<T>(ref T a, ref T b)
Parameters
| Type | Name | Description |
|---|---|---|
| T | a | First value. |
| T | b | Second value. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the values |