Skip to main content

Posts

Showing posts with the label binding Time

Choose Binding Time Consciously, Awake and Start functions for Initialization

So I ran into a simple but annoying problem when I was trying to hurry up and finish a game I have been working on for a while so I could move on to start a new idea. I was being stupid an hard coding the last features I wanted to include in the game, and of course came across a problem that I spent 30 minutes on that I could of easily avoided if I was thinking. Here is how the problem began. I needed a way to keep up with all the Light projectors in my scene and figure out which ones are close to me. This sounded easy enough, but alas I managed to screw it up. The code I wrote  used an array that was set on the awake  method using GameObject.FindGameObjectsWithTag("TagName"); In my scene, the player is already in my scene, and the lights are not. When my scene is played, a script called GameInit calls the city generator which in turn calls the multiple factories, one being the factory that generates all the lights in my game. Although it looks like when my scen...