I have the GrayScale Image Effect, that put all the screen white and black, so i have too in my
LateUpdate void that when my Life is lower that 16 I add the GrayScale effect to the MainCamera, but this GrayScale
is added infinitely how i can add it 1 time?
this is my Script:
void LateUpdate()
{
LowLife();
}
void LowLife()
{
Grayscale grayscale;
if (currentHealth <= lowLife)
{
Camera.main.gameObject.AddComponent<Grayscale>(); // Add the GrayScale
if (!lowLifeSource.isPlaying && !dead)
{
lowLifeSource.clip = heartClip;
lowLifeSource.Play();
}
}
else
{
if (!dead)
{
lowLifeSource.Stop();
}
}
}