Hi, im new in the Coding scene so i watched some stuff, read some tutorials and i realy understand some basics!
That´s awesome!
Now i got 400 Lines in a Script, awesome and i was asking me if there is a limit set from Unity?
I know 400 is not that mutch but does it change the Performance any way ore is it just useful to have more Scripts to get a nice overview?
There is no limitation on how long the file can be it will also not affect performance unless ALL of your logic is done on Update within one script then yeah you might get some problems.
I recommend you stay away from having one large file and split them up using Object Oriented Designs. Even then, you still might have lengthy scripts but thats okay. I have a player script that is about 1,200 lines of code not including the inheritance…
Also to help improve performance try to cache references whenever possible to prevent having to use GetComponent so many times as this can be an expensive operation.
There is no limit. And there is no performance hit neither.
It just makes no sense to write everything into one big monster script. Scripts that belongs to a specific object should be attached to this specific object since it has to deal with this object. And with a too big script you loose yourself in the code.
Also to take into account is reusability. Like you want to rotate a object by a specific amount, and you want to reuse this functionality at other objects. So instead of writing one big monster script for every object separately you can simply write a small script for just the rotation part, and attach it to all other objects then.