The question is answered, right answer was accepted
Using enum as a string with an if statement
I don't have the code on me so I might of typed something weird but heres an example.
public SpecialPeople sPep;
public Text blahText;
public enum SpecialPeople
{
Bob,
Mario,
Dude,
Ect.....
}
void Update ()
{
If (blahText.text == sPep.ToString())
{
//SomethingHappens
}
}
Whats happening is when I do the ToString () it only works for the first one on the enum list. Now I could go through and do SpecialPeople. And then the name but if I have a lot of names on the list then I have to add each and everyone of the names. That would be harder not smarter. Let me know if you know any alternate things I could do to accomplish this task. Thanks in advance!
I looked at link text
but I didn't get anything out of it. Let me know if I missed something.
Answer by ThePokedog1 · Aug 31, 2015 at 04:59 AM
Haven't got an answer back for this so I guess I'll just do it the long way by :
If (blahText.text ==SpecialPeople.Bob) If (blahText.text ==SpecialPeople.Mario) If (blahText.text ==SpecialPeople.Dude) If (blahText.text ==SpecialPeople.Ect)
If you find an answer to my original question let me know cause I would like to know for the future.