Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Linq;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
@teebarjunk
teebarjunk / RenderTextureToFile.cs
Last active November 3, 2022 16:34
Unity: Adds a context menu option to RenderTextures that allows saving them to a file.
public static class RenderTextureToFile
{
[UnityEditor.MenuItem("CONTEXT/RenderTexture/To Texture")]
static void SaveRenderTextureToTexture(UnityEditor.MenuCommand command)
{
var rt = (RenderTexture)command.context;
if (rt == null)
return;
// Ask for a save path.