- Own things to do on their own
Example: The official tutorial "Tanks Tutorial", small tanks: mobile, mobile sound, shooting, health management, etc. component are mounted on the gameobject tank own body. Shells, then manage their own explosions and so on.
Many benefits:
~ more convenient when developing and maintaining
~ Meet the "face of the object" thinking
A script to do one thing
Example: The official tutorial "Tanks Tutorial", the small tank: C # script divided into three, mobile, life management, shooting.
Many benefits:
~ The blast script in the shells can call life management individually to change the health value.
~ More clarity of code
~ more convenient when developing and maintaining
Think: Is that the same thing in a big project?
Script Reuse
For example: The official tutorial "Adventure Game Tutorial" has a lot of script reuse. This programming idea is very simple, that is, script x, you can give a at the same time, give B, for C. There are many benefits, you just write a script x. Of course there are advantages and difficulties, it requires you to have a better understanding of the project, which scripts can be reused, those functional scripts can be summed up together, which is not.
The script is reused with the previous two contradictions. In fact, not contradictory:
-Do your own thing yourself-for gameobject,
-a script to do one thing, for the function of the script,
-Script reuse, for script use
[Game development-Learning notes] Rookie slowly Fly (iii)-Official tutorial Learn to be careful