Newer
Older
BlackoutClient / Assets / Scripts / CubeMap.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CubeMap : MonoBehaviour
{
    private Camera see;

    public RenderTexture SeeMap;
    // Start is called before the first frame update
    void Start()
    {
        see = gameObject.AddComponent<Camera>();
        see.enabled = false;
        see.farClipPlane = 20;
        see.nearClipPlane = 0.1f;

        SeeMap = new RenderTexture(1024, 1024, 16, RenderTextureFormat.Depth);
        SeeMap.dimension = UnityEngine.Rendering.TextureDimension.Cube;
    }

    // Update is called once per frame
    void Update()
    {
        see.targetTexture = SeeMap;
        if (!see.RenderToCubemap(SeeMap))
        {
            Debug.LogError("FAILED :(");
        }
        see.targetTexture = null;

        //see.Render();

    }
}