Skip to content

Instantly share code, notes, and snippets.

View V3GS's full-sized avatar

Victor Riascos V3GS

View GitHub Profile
@V3GS
V3GS / DrawToScreen.cs
Created September 24, 2025 16:37
Draw all the children that have the Mesh Renderer component using the CommandBuffer.DrawRenderer method (Built-in RP) and Blit that information into the main camera
using UnityEngine;
using UnityEngine.Rendering;
public class DrawToScreen : MonoBehaviour
{
// Camera reference
private Camera refCamera;
// Target render texture
private RenderTexture refRenderTexture;
// Command buffer that will hold list of rendering commands
@V3GS
V3GS / OverrideMaterial.cs
Created September 24, 2025 16:28
Override material by using the OnEndContextRendering callback (UniversalRP)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RendererUtils;
using UnityEngine.Rendering.Universal;
using UnityEngine.Serialization;
public class OverrideMaterial : MonoBehaviour
{