Version: 2019.2
LanguageEnglish
  • C#

Graphics

class in UnityEngine

/

Implemented in:UnityEngine.CoreModule

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

Raw interface to Unity's drawing functions.

This is the high-level shortcut into the optimized mesh drawing functionality of Unity.

Static Properties

activeColorBufferCurrently active color buffer (Read Only).
activeColorGamutReturns the currently active color gamut.
activeDepthBufferCurrently active depth/stencil buffer (Read Only).
activeTierGraphics Tier classification for current device. Changing this value affects any subsequently loaded shaders. Initially this value is auto-detected from the hardware in use.
preserveFramebufferAlphaTrue when rendering over native UI is enabled in Player Settings (readonly).

Static Methods

BlitCopies source texture into destination render texture with a shader.
BlitMultiTapCopies source texture into destination, for multi-tap shader.
ClearRandomWriteTargetsClear random write targets for Shader Model 4.5 level pixel shaders.
ConvertTextureThis function provides an efficient way to convert between textures of different formats and dimensions. The destination texture format should be uncompressed and correspond to a supported RenderTextureFormat.
CopyTextureCopy texture contents.
CreateAsyncGraphicsFenceShortcut for calling Graphics.CreateGraphicsFence with GraphicsFenceType.AsyncQueueSynchronization as the first parameter.
CreateGraphicsFenceCreates a GraphicsFence which will be passed after the last Blit, Clear, Draw, Dispatch or Texture Copy command prior to this call has been completed on the GPU.
DrawMeshDraw a mesh.
DrawMeshInstancedDraw the same mesh multiple times using GPU instancing.
DrawMeshInstancedIndirectDraw the same mesh multiple times using GPU instancing.
DrawMeshNowDraw a mesh immediately.
DrawProceduralDraws procedural geometry on the GPU.
DrawProceduralIndirectDraws procedural geometry on the GPU.
DrawProceduralIndirectNowDraws procedural geometry on the GPU.
DrawProceduralNowDraws procedural geometry on the GPU.
DrawTextureDraw a texture in screen coordinates.
ExecuteCommandBufferExecute a command buffer.
ExecuteCommandBufferAsyncExecutes a command buffer on an async compute queue with the queue selected based on the ComputeQueueType parameter passed.It is required that all of the commands within the command buffer be of a type suitable for execution on the async compute queues. If the buffer contains any commands that are not appropriate then an error will be logged and displayed in the editor window. Specifically the following commands are permitted in a CommandBuffer intended for async execution:CommandBuffer.BeginSampleCommandBuffer.CopyCounterValueCommandBuffer.CopyTextureCommandBuffer.CreateGPUFenceCommandBuffer.DisableShaderKeywordCommandBuffer.DispatchComputeCommandBuffer.EnableShaderKeywordCommandBuffer.EndSampleCommandBuffer.GetTemporaryRTCommandBuffer.GetTemporaryRTArrayCommandBuffer.IssuePluginEventCommandBuffer.ReleaseTemporaryRTCommandBuffer.SetComputeBufferParamCommandBuffer.SetComputeFloatParamCommandBuffer.SetComputeFloatParamsCommandBuffer.SetComputeIntParamCommandBuffer.SetComputeIntParamsCommandBuffer.SetComputeMatrixArrayParamCommandBuffer.SetComputeMatrixParamCommandBuffer.SetComputeTextureParamCommandBuffer.SetComputeVectorParamCommandBuffer.SetComputeVectorArrayParamCommandBuffer.SetGlobalBufferCommandBuffer.SetGlobalColorCommandBuffer.SetGlobalFloatCommandBuffer.SetGlobalFloatArrayCommandBuffer.SetGlobalIntCommandBuffer.SetGlobalMatrixCommandBuffer.SetGlobalMatrixArrayCommandBuffer.SetGlobalTextureCommandBuffer.SetGlobalVectorCommandBuffer.SetGlobalVectorArrayCommandBuffer.WaitOnGPUFenceAll of the commands within the buffer are guaranteed to be executed on the same queue. If the target platform does not support async compute queues then the work is dispatched on the graphics queue.
SetRandomWriteTargetSet random write target for Shader Model 4.5 level pixel shaders.
SetRenderTargetSets current render target.
WaitOnAsyncGraphicsFenceInstructs the GPU's processing of the graphics queue to wait until the given GraphicsFence is passed.