It shouldn't matter too much how many scripts you have. The thing that will kill your processor's speed is how many "Update" functions you have and the complexity of the code in those update functions.
If a script doesn't use it's update function, delete it from the code.
I'm making an fps, and I personally think it wouldn't be ridiculous to have 30ish scripts on one player. The idea behind a script is organization. If you want your code to be easy to read, it would be better that you segment it as much as possible (so long as it's still convenient).
For instance, in my game I will eventually have all of these:
1) Rotation script (Done)
2) Movement script (Done)
3) Parkour initial checks (Done)
4) Parkour script/Mantle (WIP)
5) Parkour script/Vault (WIP)
6) Gun Controller
7) Gun#1
8) Gun#2
9) Gun#3
10) Gun#4
Tips: Optimize your code by caching variables like transform (var trans : Transform;).
Tips: Use coroutines instead of update for functions that don't need to be called every millisecond of existance.
Tips: Lastly, don't do stuff you don't need to (this may seem obvious, but I have plenty of unnecessary code atm).
Look up "Optimization Unity3d" on Google and you will learn a LOT. Especially if you type in Optimization Unity3d iPhone/Android, but if you are making a FPS don't apply any iPhone/Android optimizations, assuming it's a pc game.
↧