You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
499 B
27 lines
499 B
11 months ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using Unity.VisualScripting;
|
||
|
using UnityEngine;
|
||
|
|
||
|
[ExecuteInEditMode]
|
||
|
public class CubemapRender : MonoBehaviour
|
||
|
{
|
||
|
public RenderTexture cubeMap;
|
||
|
int faceMask = 63;
|
||
|
Camera cam;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
cam = GetComponent<Camera>();
|
||
|
}
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
if (cubeMap != null)
|
||
|
{
|
||
|
// Render the scene to the cubemap
|
||
|
cam.RenderToCubemap(cubeMap, faceMask);
|
||
|
}
|
||
|
}
|
||
|
}
|