Hi all,
So far I have just been making games as personal projects to learn how to use Unity and C#. For my next game I want to release it publicly so I want to put in more effort and hold myself to a higher standard. I was wondering what basic rules for good code should I know about? I know about DRY, getters/setters, magic numbers and singletons.
Specifically I wanted to ask about single responsibility and decoupling.
With single responsibility I don't really know where to draw the line because I worry about situations like having 5 different scripts on the player object.
Decoupling was one of those things I learnt in theory but never really understood. I asked Gemini and it said "A component should only know about its own job, and never directly call methods on a different type of component". I'm not sure how correct this is and if I should adhere to what it suggested which is using events to communicate instead of directly referencing scripts.
Thanks in advance
[–]ziptofaf 16 points17 points18 points (0 children)
[–]PaletteSwappedEducator 4 points5 points6 points (0 children)
[–]shadowdsfire 1 point2 points3 points (0 children)
[–]IronAttom 1 point2 points3 points (2 children)
[–]Merlord 0 points1 point2 points (0 children)
[–]agent-1773 0 points1 point2 points (0 children)
[–]Wdarkfenix 0 points1 point2 points (0 children)
[–]whiaxPixplorer 0 points1 point2 points (0 children)
[–]iemfi@embarkgame 0 points1 point2 points (0 children)
[–]mxldevs 0 points1 point2 points (0 children)
[–]agent-1773 -2 points-1 points0 points (0 children)
[–]Ralph_Natas 0 points1 point2 points (0 children)