This repository has been archived on 2026-01-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
simulatorDesign/Assets/SharedAssets/Scripts/Runtime/ScreenCamera.cs
2025-06-18 10:34:00 +09:00

20 lines
581 B
C#

using UnityEngine;
using UnityEngine.Experimental.Rendering;
public class ScreenCamera : MonoBehaviour
{
[SerializeField] private float m_RenderTextureScale = 1;
private Camera m_Camera;
void Awake()
{
m_Camera = GetComponent<Camera>();
UpdateTarget();
}
private void UpdateTarget()
{
m_Camera.targetTexture = new RenderTexture((int)(m_Camera.scaledPixelWidth * m_RenderTextureScale), (int)(m_Camera.scaledPixelHeight * m_RenderTextureScale), GraphicsFormat.R16G16B16A16_SFloat, GraphicsFormat.D24_UNorm_S8_UInt);
}
}