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.
CloseFor 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.
CloserenderRequest | All the necessary information to render a request, for example render destination, mipmap level, slice index, and so on. This information varies based on the RequestData type. |
Submits a render request to the camera outside of Unity render loop.
Call this method or RenderPipeline.SubmitRenderRequest to render outside of Unity render loop and output the render pipeline to the render destination specified in the RequestData
parameter. Before submitting the request, use RenderPipeline.SupportsRenderRequest to verify that the render pipeline supports the RequestData
type you have selected. The request is processed sequentially within your script, and no callback mechanism is involved.
The Universal Render Pipeline (URP) supports the following RequestData
types:
The High Definition Render Pipeline (HDRP) supports the following RequestData
types:
The Built-In Render Pipeline only supports the ObjectIdRequest request type.
For more information about how to render a render request in URP, refer to Create a Render Request in URP.
// This example sends render requests when the GUI button "Render Request" is selected. // To use it, attach the script to a camera and select Enter Play Mode.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering;
[RequireComponent(typeof(Camera))] public class StandardRenderRequest : MonoBehaviour { [SerializeField] RenderTexture texture2D, texture2DArray, cubeMap, texture3D;
// Create a button you can use to send a render request private void OnGUI() { GUILayout.BeginVertical(); if (GUILayout.Button("Render Request")) { SendRenderRequests(); } GUILayout.EndVertical(); }
// Send render requests outside of Unity render loop void SendRenderRequests() { Camera camera = GetComponent<Camera>();
// Create a standard request. This is supported only in HDRP and URP. RenderPipeline.StandardRequest request = new RenderPipeline.StandardRequest();
// Check if the request is supported by the render pipeline if (RenderPipeline.SupportsRenderRequest(camera, request)) { // Submit the render request to the render pipeline with different destination textures
// Render to a 2D texture request.destination = texture2D;
// Render the camera, and fill the 2D texture with its view camera.SubmitRenderRequest(request);
// Render to a 2D texture array request.destination = texture2DArray; for (int i = 0; i < texture2DArray.volumeDepth; i++) { request.slice = i; // Render the camera and fill slice i of the 2D texture array with its view camera.SubmitRenderRequest(request); }
// Render to a cubemap texture var faces = new[] { CubemapFace.NegativeX, CubemapFace.PositiveX, CubemapFace.NegativeY, CubemapFace.PositiveY, CubemapFace.NegativeZ, CubemapFace.PositiveZ }; request.destination = cubeMap; foreach (var face in faces) { request.face = face; // Render the camera and fill each face of the cubemap texture with its view camera.SubmitRenderRequest(request); }
// Render to a 3D texture request.destination = texture3D; for (int i = 0; i < texture3D.volumeDepth; i++) { request.slice = i; // Render the camera and fill slice i of the 3D texture with its view camera.SubmitRenderRequest(request); } } } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.