If() not being accepted

The category string has been found and tested, but when I do the “if” I get an error, see below where the error is.
The name found in category is Planet, DwarfPlanet, Star. I don’t get it, category returns a star, or planet, but I get an error when I ask the if question.

var category  = GameObject.Find("Galaxy" + cSystem).transform.Find("" + i).GetComponent<Info>().category;

if (category != "Star") {Then do this} // Operator '!=' cannot be applied to operands of type 'Info.Category' and 'string'

I have a script in one of my files named Info, here are the info for the gameObjects, like name, type, category etc. When I use Name instead of category no error, name is the text you type in, category has a drop down list, maybe thats the problem.

Try changing category to category.name:

if (category.name != "Star")

Robertbu gave me a great idea, since he said its an enum, I’ve decided to turn it into a string, heres the new code.

var category  = GameObject.Find("Galaxy" + cSystem).transform.Find("" + i).GetComponent<Info>().category.ToString();
if (category != "Star") { print ("It worked");}

Thanks for you help

For me it already looked like a string.