Efficiency of accomplishing everything with fewer scripts

I wrote a beautiful script. It’s the longest and most complicated I’ve ever written. It’s probably not that advanced, but I used several enumerators, for example, which I’ve never used before, and it was pushing my brain to it’s limits.

The script selects one of three meshes at random, selects one of three sizes at random or decides which size it needs to be based off the size of the object instantiating it. It moves the game object in a random direction, and rotates it in a random fashion. And a bunch of other smaller things. I did this some what for the sake of learning new techniques, but I also thought it would be neater to have one object prefab, and one script to change it up a lot instead of having many prefabs(like small with mesh 1, small with mesh 2, small with mesh 3, medium with mesh 1…).

I had many hardships that could have been avoided by using many prefabs, but I don’t regret my decision to use one. But I am curious? Which requires more computational power?

More objects is more intensive, script wise, due to the overhead associated with each one.

Having more scripts is kind of like appending them functionally end to end as that’s what eventually becomes of them, so to speak. If each object is running a script the overheads will eventually mean that there is more processing to be done for the same amount of actual script. If your one big script does not put a strain on the FPS then there is no issue with it.

Systems can handle millions of processes per second. What brings the FPS down is where loops and expensive calls or operations are involved. If an operation is particularly expensive it will notably mention it in the docs.

If your approach works, don’t over analyze it.