saraaaaras / Redo-YYY-New

0 stars 0 forks source link

Spilt the script #8

Open PCRedHot opened 1 year ago

PCRedHot commented 1 year ago

https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs

You code all the systems into one script. This is not how unity works. Unity works by attaching MonoBehaviour children classes to objects and each has its own role.

Although a game system object should exist in the scene for completeness, it should not handle everything together in one script. One example would be adding Listener, you can have separate scripts for buttons, so the handling of the onClick behaviour could be managed on their own script.

This style of one-script is ok (actually not really ok xd) for this kind of small project, but soon it would be very hard to expand it.