So I have a script that cause the camera to glitch, I want when you enter a box collider the glitch script becomes actives for a few seconds the turns off I tried make my own but i keep getting errors
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class glitchon : MonoBehaviour
{
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
GlitchCameraShader =
other.gameObject.GetComponent<GlitchCameraShader>();
gameObject.GetComponent(GlitchCameraShader).enabled = true;
yield return new WaitForSeconds(0.05f);
gameObject.GetComponent(GlitchCameraShader).enabled = false;
}
}
}