Skip to content

Instantly share code, notes, and snippets.

View shingming's full-sized avatar
💭
Hungry

Tim Wong shingming

💭
Hungry
View GitHub Profile
@mminer
mminer / VerticallyFlipRenderTexture.cs
Created February 18, 2021 21:39
Unity function to vertically flip a render texture.
/// <summary>
/// Vertically flips a render texture in-place.
/// </summary>
/// <param name="target">Render texture to flip.</param>
public static void VerticallyFlipRenderTexture(RenderTexture target)
{
var temp = RenderTexture.GetTemporary(target.descriptor);
Graphics.Blit(target, temp, new Vector2(1, -1), new Vector2(0, 1));
Graphics.Blit(temp, target);
RenderTexture.ReleaseTemporary(temp);