Quantcast
Channel: Latest Questions by Shiro_Rin
Viewing all articles
Browse latest Browse all 50

Lighting script

$
0
0
I use a script to flicker lights to produce a lighting effect from a thunderstorm. However all my lights flash at different intervals. I tried making it an array of objects and to make them all flash at the same time using this code var lights: GameObject[]; var flickerSpeed : float = 0.07; private var randomizer : int = 0; while (true) { if (randomizer == 0) { lights.GetComponent.().enabled = false; } else lights.GetComponent.().enabled = true; randomizer = Random.Range (0, 1.1); yield WaitForSeconds (flickerSpeed); } However I get the error Assets/_Scripts/Flickerv2.js(6,16): BCE0019: 'GetComponent' is not a member of 'UnityEngine.GameObject[]'. Any help on a way to approach this is appreciated.

Viewing all articles
Browse latest Browse all 50

Trending Articles



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