private void FinishFrame() { Unsupported.RestoreOverrideLightingSettings(); foreach (var light in lights) { light.enabled = false; } }
public Texture EndPreview() { Unsupported.RestoreOverrideLightingSettings(); m_SavedState.Restore(); FinishFrame(); return(m_RenderTexture); }
public Texture2D EndStaticPreview() { if (!EditorApplication.isUpdating) { Unsupported.RestoreOverrideLightingSettings(); } var tmp = RenderTexture.GetTemporary((int)m_TargetRect.width, (int)m_TargetRect.height, 0, GraphicsFormat.R8G8B8A8_UNorm); Graphics.Blit(m_RenderTexture, tmp, EditorGUIUtility.GUITextureBlit2SRGBMaterial); RenderTexture.active = tmp; var copy = new Texture2D((int)m_TargetRect.width, (int)m_TargetRect.height, TextureFormat.RGB24, false, false); copy.ReadPixels(new Rect(0, 0, m_TargetRect.width, m_TargetRect.height), 0, 0); copy.Apply(); RenderTexture.ReleaseTemporary(tmp); m_SavedState.Restore(); FinishFrame(); return(copy); }