Single enum class

My question is would it be best too make a static class that contains all my enums for my project or have them in a script that has too do with the enum.

Just creating a .cs file will suffice - just as you’d create a class, it needs not be attached to any gameObject or inherit from MonoBehavior. So long as they’re set to public you’ll be able to access them.

// Your .cs file

public enum NumberOne
{
     hello,
     this,  //Invalid syntax xD
     is,    //Invalid syntax xD
     accessible,
     anywhere
 }

// End of .cs file

They need to be enclosed in a static class :slight_smile:

As for whether or not you should store them all in one file, that’s a subjective question really.

My opinion is no they shouldn’t. Each Enum should be in it’s own .cs file residing in an appropriate folder - say the folder that contains the class that uses it?

Again though purely subjective there is no right or wrong - apart from storing them in a static class :stuck_out_tongue:

I wasn’t able to get it to work in an external class, but adding it to the script I was referencing it in, outside of that class worked. Strange.