Skip to main content
Discovery icon for Official Unity Discord Discord server

Official Unity Discord

22,260 Online
140,072 Members
# 💻┃unity-talk4 people

how to structure player classes

Balancing SOLID principles against over-engineering depends on project scope, with recommendations ranging from minimal scripts to modular component splits.

  • Simple projects can manage with minimal separation like a Player script and a PlayerCamera, avoiding modularity until requirements like multiplayer demand it
  • Applying SOLID principles advocates for single-responsibility classes using inheritance, composition, or interfaces to decouple modular features
  • A player script reaching thousands of lines indicates a strong need for modular restructuring
  • Base classes can be introduced later once shared functionality or multiple implementations become necessary
  • A practical middle-ground architecture separates responsibilities into distinct Player, PlayerController, and PlayerAnimator scripts
Summarized from recent messages, might be inaccurate

More conversations

Talk, Play, &
Hang Out

Find your space to hang out, discuss the latest updates with the party chat, and see who's down to join your next match.
Get App