
Command Buffers Explained in Unity
February 23, 2026
Root Motion vs In-Place Animations
February 23, 2026Unity’s rendering system has evolved significantly over the years. Instead of relying only on the built-in render pipeline, Unity now offers the Scriptable Render Pipeline (SRP), which gives developers much more control over how objects are rendered.
If you’ve heard terms like URP or HDRP, they are built on top of SRP. Understanding the basics of SRP helps you understand modern Unity rendering.
What Is Scriptable Render Pipeline?
Scriptable Render Pipeline is a customizable rendering framework. Instead of Unity deciding exactly how rendering works internally, SRP allows developers to define rendering behavior through C# scripts.
In simple terms, SRP lets you control:
- What gets rendered
- When it gets rendered
- How it gets rendered
Built-in Pipeline vs SRP
Built-in Pipeline:
- Fixed rendering process
- Limited customization
- Uses legacy shaders
Scriptable Render Pipeline:
- Fully customizable rendering flow
- Modern shader support
- Better performance optimization options
URP and HDRP
Unity provides two main SRP implementations:
- Universal Render Pipeline (URP) – optimized for performance and cross-platform support
- High Definition Render Pipeline (HDRP) – focused on high-end visuals
Both are built using SRP principles.
Core SRP Components
At a high level, SRP is made of three main parts:
- Render Pipeline Asset
- Render Pipeline Instance
- Render Context
Render Pipeline Asset
This asset stores configuration settings and creates the pipeline instance.
Render Pipeline Instance
This is where the actual rendering logic is defined.
ScriptableRenderContext
This object communicates with Unity’s low-level rendering system.
Simple Custom SRP Example
Below is a minimal example of creating a very basic custom render pipeline.
Step 1: Create a Render Pipeline Asset
using UnityEngine;
using UnityEngine.Rendering;
[CreateAssetMenu(menuName = "Rendering/Custom Render Pipeline")]
public class SimpleRenderPipelineAsset : RenderPipelineAsset
{
protected override RenderPipeline CreatePipeline()
{
return new SimpleRenderPipeline();
}
}
Step 2: Create the Render Pipeline
using UnityEngine;
using UnityEngine.Rendering;
public class SimpleRenderPipeline : RenderPipeline
{
protected override void Render(
ScriptableRenderContext context,
Camera[] cameras)
{
foreach (Camera camera in cameras)
{
context.SetupCameraProperties(camera);
CommandBuffer cmd = new CommandBuffer();
cmd.ClearRenderTarget(true, true, Color.black);
context.ExecuteCommandBuffer(cmd);
cmd.Release();
context.Submit();
}
}
}
This example clears the screen with black but does not render any geometry. It shows the structure of an SRP.
How to Use a Custom SRP
- Create the Render Pipeline Asset in the Project window.
- Go to Edit → Project Settings → Graphics.
- Assign your custom pipeline asset to the Scriptable Render Pipeline field.
Unity will now use your custom rendering logic.
Why Use SRP?
You might consider SRP if:
- You need custom rendering passes
- You want advanced post-processing
- You need optimized rendering for a specific platform
- You want full control over the render order
SRP vs Command Buffers
Command Buffers allow you to inject commands into the existing pipeline. SRP allows you to define the entire pipeline.
If you only need small rendering changes, Command Buffers may be enough. If you need full control, SRP is the solution.
Important Concepts to Learn Next
- ScriptableRenderPass
- ScriptableRendererFeature (URP)
- Custom post-processing in URP
- Shader Graph for SRP
Performance Considerations
- SRP allows fine-grained optimization
- You can remove unnecessary rendering steps
- Incorrect implementation can reduce performance
- URP is generally best for most projects
Final Thoughts
Scriptable Render Pipeline gives developers deep control over Unity’s rendering system. While the built-in pipeline works well for many projects, SRP opens the door to custom rendering techniques and performance optimization.
You don’t need to write your own SRP to benefit from it. Using URP or HDRP already gives you the advantages of the Scriptable Render Pipeline architecture.










