Light 'Em Up Challenge - Why in Start()?

Maybe this is “part of the challenge” but I don’t know if I’d consider it very helpful. The challenge tells you to set the initial color in the Start() method. The problem is that later when you’re picking a random color, Start() doesn’t occur right away. This means you could be changing the color when instantiating and then it’s changing back to default from the start method, so it looks like you never changed it.

All of this confusion can be avoided if you just use Awake() instead of Start(). You could also check in Start if the color is not the default (and has therefore already been assigned) or you could use a coroutine to delay the color change (in the hopes that it occurs after Start), but those seem unnecessary and come with their own issues. It’s just easier to use Awake().

Again, if the point is to figure this all out, then cool, but it feels weird that the suggestion from earlier in the challenge actually causes a potential bug - especially one like this.

Privacy & Terms