Код: Выделить всё
[ExecuteInEditMode]
public class vignetteController : MonoBehaviour
{
public Material material;
public float vignette = 1f;
public float maxVignette = 1f;
public InTheLight ITL;
void Update()
{
if(ITL.isStandingInLight == true)
{
StopCoroutine(YouGonnaDie());
vignette = 1f;
material.SetFloat("vignetteRadius", vignette / maxVignette);
}
else if(ITL.isStandingInLight == false)
{
StartCoroutine(YouGonnaDie());
}
// Make it a coruntine instead of something this complicated and dyinamic
}
IEnumerator YouGonnaDie()
{
vignette -= 0.01f;
material.SetFloat("vignetteRadius", vignette / maxVignette);
yield return new WaitForSeconds(3);
// Jumpscare
}
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination, material);
}
}


Это кажется простой вещью, но я у меня такие проблемы, если ты знаешь решение, пожалуйста, предоставьте комментарий или пример, спасибо!
Подробнее здесь: https://stackoverflow.com/questions/791 ... bjects-use