# How can I add a new item to my enum list in the inspector?

I have a list of enums. I want to add a new item to it without scripting to make them more easily modifiable for game designers. I made an inventory system and I want to define the type of an item. For an example apple is a type of food and stone is a type of object.

Is there a way to group these items in the inspector?

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {
public const string[] typesStrings = {"Player", "Prop", "Enemy"};
[System.Serializable]
public class TypeList
{
public enum types
{
PLAYER = 0,
PROP = 1,
ENEMY = 2
}

};

// MonoBehaviour class
public TypeList.types selectedType;

public void Start()
{
string selected = TypeList.typesStrings[(int)selectedType];
}
}


This, however, gives me the following error:

Assets/grouping.cs(5,31): error CS0134: A constant grouping.typesStrings' of reference typestring[]' can only be initialized with null

• Please only ask one question at a time. I removed the second question from your post. But feel free to post it again as a new question. You can retrieve the text and image from the edit history. – Philipp Jul 13 '16 at 15:22
• To work around that particular error, I usually define my constant arrays as static readonly which is not quite constant (the array contents are still mutable) but close enough for my purposes. – DMGregory May 8 '20 at 2:29
• @DMGregory enums have many problems so I use ScriptableObjects instead. – Seyed Morteza Kamali May 8 '20 at 6:14

you can use System.Serializable

using UnityEngine;
using System.Collections;
public class grouping: MonoBehaviour {
[System.Serializable]
public class class1{
public enum myEnum {one,two,three};
public myEnum[] row;
public string name;
public int price;
}
public class1[] array;
}