playMaker

Author Topic: Enums - Best Practice  (Read 1017 times)

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 256
Enums - Best Practice
« on: February 24, 2023, 10:43:36 PM »
So I just discovered Enums and they are fantastic. Makes my project so much easier to manage and understand. I was wondering though, what's best practice on how to use them?

1. Should each use case be independent and has its own c# script?
2. Should I put everything from my project into the same c# script?

Right now I went with option 2 and called it "ProjectEnums.cs". My idea is to put all my enums in it (not that I will have that much, but in the end it's probably 5-10.

Does that make sense or would it be better if I divided them into separate c# scripts?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Enums - Best Practice
« Reply #1 on: February 25, 2023, 06:47:37 AM »
Hi.
1 Script is fine for most projects

on large project you might want to set a few with different namespaces

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 256
Re: Enums - Best Practice
« Reply #2 on: February 25, 2023, 08:19:31 AM »
Awesome! Thanks so much for the feedback!