- Home /
big script vs many scripts
Which is a better way to make a game? One with many small scripts or one with only a few big scripts.
I want to make a game that will randomly create an environment.
Ex: An empty game object creating a terrain, trees in random parts, houses in random areas, random life, etc. ALL in function Start(). Then put all these things in Arrays. It can access every tree, every house, every lifeform, etc. All with ONE script.
Or would it be better to make a script that creates a bunch of prefabs with scripts of their own?
Answer by Graham-Dunnett · Nov 13, 2012 at 08:55 PM
Which is better? A car that does 100miles per gallon, or one that you can drive at 250 miles per hour? It depends completely on what you mean by "better".
In general, break your code into small pieces. Document the code well, so you can easily understand in 3 months time what the code does and why it's needed.
In your example you can probably get away with all your code in Start(). But then I'd disagree that that is a big script.
+1 The smaller the better, as long as you keep your classes well organized