using UnityEngine;
namespace Unity.XR.CoreUtils
{
///
/// Utilities for manipulating Textures.
///
public static class TextureUtils
{
///
/// Copy a given to a .
/// This method assumes that both textures exist and are the same size.
///
/// The source .
/// The destination .
public static void RenderTextureToTexture2D(RenderTexture renderTexture, Texture2D texture)
{
RenderTexture.active = renderTexture;
texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
texture.Apply();
}
}
}