Public or static Enums?

Hi,

I’m trying to define a Enum in a script file which I want to use in all scripts in the project. I defined in script A:

enum GameMode
{
Easy = 0,
Hard = 1,
Ultra = 2
}

So my basic problem is that I can’t put before the enum a “static” to have it like this:

Script B:

function doSomethingBasedOnGameModes(gamemode : GameMode) {

Putting a static before the enum throws an error, looks like static not allowed for enums. How can I “import” this enum or make it publically available? Or is there any other preferred method of making enums public?

Thanks for your help,
Martin

You don’t actually have to do anything…enums are available from other scripts anyway.

–Eric

1 Like

Not sure exactly what happens in Javascript, but in C#, if you define an enum inside the body of a class, you have to use the name of the class in front of it: ClassName.EnumName.Item.

1 Like

Ah, thanks, I had not tried to just use them without any prefix, right, works without any classname or alike upfront. Thanks for your help.