- Home /
Enum to value table/array for editor
Is there a simple way of using an enum in a MonoBehavior class to show up in the editor as a table where I can assign values to each element for game object individually?
let's say my enum:
enum types{
WATER,LAVA,GRASS,SAND,DARK_VOID
}
And then in the unity editor I would like to have something like:
//My assigned values inserted by editor
/*my enum names*/ WATER -> [20]
LAVA -> [30]
GRASS -> [5]
SAND -> [10]
etc
By value I don't mean the actual Enum item value. It's more in the sense of coupling separate values to an item.
Answer by deltamish · Mar 05, 2013 at 03:52 PM
Hi you cant do that with an enum.to understand enum easily go here
You can get that by using class
Here is an JavaScript example
class Types{
var Water:float;
var Lava:float;
var Grass:float;
var Sand:float;
}
I know how enums work. I was asking if there was a way to create a list for the editor in which I can assign numbers to. This way I can use the enumerator as indices for the value table. And if you downvoted me, at least say why.
Agreed, that is an inconsiderate undefined hit-and-run downvote. Am upvoting your question to help get the traffic to your question (although I think the wise $$anonymous$$ds here will be able to deter$$anonymous$$e this is a decent question). Sorry I cannot help with the actual question, Good Luck.
Your answer

Follow this Question
Related Questions
Custom editor not editing? 1 Answer
List instances names of a class 2 Answers
How to create bitmask flags per scene that are available in the editor? 0 Answers
Editor window BuildTarget as enum 2 Answers
Default Editor : Enum as flags ? 8 Answers