cvr-props/Assets/ABI.CCK/Components/CVRGIMaterialUpdater.cs

26 lines
727 B
C#
Raw Normal View History

2023-01-22 16:38:23 +01:00
using UnityEngine;
namespace ABI.CCK.Components
{
[AddComponentMenu("ChilloutVR/CVR GI Material Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/gi-material-updater/")]
2023-01-22 16:38:23 +01:00
[RequireComponent(typeof(Renderer))]
public class CVRGIMaterialUpdater : MonoBehaviour, ICCK_Component
2023-01-22 16:38:23 +01:00
{
#pragma warning disable 649
2023-01-22 16:38:23 +01:00
[SerializeField] bool updateEveryFrame;
#pragma warning restore 649
2023-01-22 16:38:23 +01:00
private Renderer _renderer;
private void Start()
{
_renderer = GetComponent<Renderer>();
}
private void Update()
{
if (_renderer == null || !updateEveryFrame) return;
_renderer.UpdateGIMaterials();
}
}
}