|
Let's say we are creating an array of GameObjects as we read a text file like so: masterScript.js
Let's say we want to add some arbitrary properties to each of our GameObjects. Let's focus on non-graphical properties to keep things clear. We parse these properties as we read each line. The way I'm currently doing it, is to add a "blank" script to "store" the properties for each object. So, I attach the blank script and assign the properties to variables. thingProperties.js
So, inside our reading loop, we end up with this:
This is the strained effort of a javascript noob, but it looks wildly inefficient to me. Clearly the thingProperties script could be added to the thingPrefab. But all these "GetComponent"s look like they might be "slow". I'd like to optimize this code. Any help would be much appreciated.
(comments are locked)
|
|
Something like this pseudocode:
(comments are locked)
|
