Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Muzzle flash script not working properly

$
0
0
Hi all, For some reason this code here doesn't work and I have no clue why: function muzzleFlash () { gameObject.GetComponent(Light).enabled = true; gameObject.GetComponent(SpriteRenderer).enabled = true; yield WaitForSeconds (0.1); gameObject.GetComponent(Light).enabled = false; gameObject.GetComponent(SpriteRenderer).enabled = false; } Whenever I use this, absolutely nothing happens when i shoot. (Note that I have these components disabled in the start). However, when I put these in opposite order (as in false goes first) it works but inversely, with the light flickering off to be on otherwise. How come it doesn't work at all this way?

Viewing all articles
Browse latest Browse all 1875

Latest Images

Trending Articles



Latest Images

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