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.
 
 
 
 
 

24 lines
570 B

using UnityEngine;
[RequireComponent(typeof(WaterBase))]
[ExecuteInEditMode]
public class SpecularLighting : MonoBehaviour
{
public Transform specularLight;
private WaterBase waterBase = null;
public void Start ()
{
waterBase = (WaterBase)gameObject.GetComponent(typeof(WaterBase));
}
public void Update ()
{
if (!waterBase)
waterBase = (WaterBase)gameObject.GetComponent(typeof(WaterBase));
if (specularLight && waterBase.sharedMaterial)
waterBase.sharedMaterial.SetVector("_WorldLightDir", specularLight.transform.forward);
}
}