Constants file in C#

I have a project with multiple scripts, many of which use the same constants.

I’d like to have a file called Constants.cs, where I define all my constants, then reference Constants.NAME whenever I want to access them.

Constants.cs looks like this:

public class Constants
{
    public const int NUMBER_OF_PLAYERS = 4;
}

My problem is that when I try to do Debug.Log(Constants.NUMBER_OF_PLAYERS), I get “The name ‘Constants’ does not exist in the current context”

How can I make the other scripts “see” Constants.cs?

Thanks

Try this…

public static class Constants
{
    public const int NUMBER_OF_PLAYERS = 4;
}

Try…

public class Constants
{
        public static const int NUMBER_OF_PLAYERS = 4;
}

You’ll need to access it with Constants.NUMBER_OF_PLAYERS;