Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Repeating a IEnumerator

$
0
0
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; } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>