So I wrote like,
var levelupFX : GameObject[];
enum element4{
Fire, Ice, Earth, Wind
}
function LeveupFX(who : int, sort : element4){
Instantiate(levelupFX[System.Enum.GetValues(typeof(sort))], transform.position, transform.rotation);
}
function OnGUI(){
if(Input.GetKeyDown("v")){
LeveupFX(1, element4.Fire);
}
}
So eventually what I want to do is, instantiating object between 4 objects as sort of element4 without using switch and string method.
But this occur error says,
InvalidCastException: Cannot cast from source type to destination type.
Then what is right method to doing extract numbers of enum? (in above case, for example, I want to get number of 1 by element4.Ice)
Thanks!