So I'm making a scp game and need to create a blink function. I have completed it but it won't loop. Any answers?
public GameObject BlinkPanel;
public bool BlinkTrue;
// Start is called before the first frame update
void Start()
{
InvokeRepeating("CastBlink", 1.0f, 1.0f);
StartCoroutine(CastBlink());
BlinkPanel.SetActive(false);
}
// Update is called once per frame
void FixedUpdate()
{
if (BlinkTrue == true)
{
BlinkPanel.SetActive(true);
}
}
IEnumerator CastBlink()
{
BlinkTrue = false;
yield return new WaitForSeconds(10);
BlinkTrue = true;
yield return new WaitForSeconds(1);
StopBlinkFunc();
}
void StopBlinkFunc()
{
BlinkPanel.SetActive(false);
BlinkTrue = false;
}
}
↧