Enum style variable

How can I create a variable that looks like an enum in the inspector?
Do I have to declare it as a class?

public class myEnumvar {
  var item1: int = 1;
  var item2: int = 2;
public var myEditableEnum: myEnumvar;

Or is there a more straightforward way of doing it?

What an enum is, is a set of non-editable named values. You can then make variables of that enum type, and those variables will be settable to any of the named values (with a useful dropdown box).

It sounds like you don’t actually mean “enum”. Do you just want to organize a set of variables into its own scope? If so, the code you’re using above is the most straightforward way of doing it. You shouldn’t call it “enum”, though, as that’s an unrelated concept.

Like this.