You cannot 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
549 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class SunDirection : MonoBehaviour {
public Material _Material;
public bool RealtimeUpdate = false;
public Vector3 L;
void SetVector()
{
if (_Material)
{
L = transform.forward;
_Material.SetVector("_L", -L);
}
}
void OnEnable () {
SetVector();
}
// Update is called once per frame
void Update () {
if(RealtimeUpdate)
SetVector();
}
}