using System; using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; [ExecuteInEditMode] public class CubemapRender : MonoBehaviour { public RenderTexture cubeMap4K; public RenderTexture cubeMap1K; public Material mat; [Header("4K Rendering")] public bool m_4k = false; int faceMask = 63; Camera cam; void Start() { cam = GetComponent(); } void Update() { if(this.isActiveAndEnabled) { if (cubeMap1K != null && cubeMap4K != null) { // Render the scene to the cubemap if (m_4k && Application.isPlaying) { cam.RenderToCubemap(cubeMap4K, faceMask); mat.SetTexture("_MainTex", cubeMap4K); } else { mat.SetTexture("_MainTex", cubeMap1K); cam.RenderToCubemap(cubeMap1K, faceMask); } } } } }