void Glitch() { float distance = Vector3.Distance(monster.position, transform.position); if (distance < monsterDistance) { glitch.GetComponent <GlitchEffect>().enabled = true; } else { glitch.GetComponent <GlitchEffect>().enabled = false; } }
// Start is called before the first frame update void Start() { glitch = GetComponent <GlitchEffect>(); glitch.GetComponent <GlitchEffect>().enabled = false; }