Quantcast
Channel: Questions in topic: "renderer.enabled"
Viewing all articles
Browse latest Browse all 99

Trying to make a renderer blink on and off, it's not working but I get no errors when building?

$
0
0
Here is my code: IEnumerator blinkTime () { if (blinking == true) { blinkTimeOn = true; while (blinkTimeOn == true) { renderer.enabled = false; yield return new WaitForSeconds (1f); blinkTimeOff = true; blinkTimeOn = false; } while (blinkTimeOff == true) { renderer.enabled = true; yield return new WaitForSeconds (1f); blinkTimeOn = true; blinkTimeOff = false; } } } I'm trying to make an object's renderer be enabled for a second then disabled for a second and this will repeat until blinking is set to false. What exactly am I doing wrong here? Edit: I should point out that I have "blinkTime" being called here: void OnTriggerEnter(Collider otherObject) { if (otherObject.gameObject.CompareTag ("Enemy")) { playerLives--; Timer = Time.time; blinking = true; blinkTime(); if (playerLives < 1) { Destroy(this.gameObject); } }

Viewing all articles
Browse latest Browse all 99

Trending Articles



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