Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

See Enumerated Indices of Array in Unity Inspector

General Tech Bugs & Fixes
Max. 2000 characters
Replies

usr_profile.png
Vanshika Bhatt

User

( 7 months ago )

In short, I have arrays that are referenced by index from an enumeration. In the inspector window of Unity, however, it simply shows "Element 0, Element 1, etc". I want the list to show the index values of my enumeration. Unless a new feature was added to Unity, I suppose this requires a special editor script, but it seems like game code can't even interface with editor code. So how do I go about this? Thanks in advance!

So if I have this:

public enum ObjectList
{
    Car,
    Sword,
    Friends,
    Depression,
    NumObjects
}

[Somehow declare to use my ObjectList Enum]
public bool [] hasItem = new bool[(int)ObjectList.NumObjects];

Ideally, the inspector would now show:

Has Item
    Size        4
    Car         []
    Sword       []
    Friends     []
    Depression  []

Instead of:

Has Item
    Size        4
    Element 0   []
    Element 1   []
    Element 2   []
    Element 3   []

Edit: Additional Example as Int Array (not just bool)

Num Item
    Size        4
    Car         0
    Sword       10
    Friends     0
    Depression  50

what's your interest


forum_ban8_5d8c5fd7cf6f7.gif