Error for 1st exactly same name var String

Hi guys,

Though I managed solved the problem but I’m curious what is going on.

var tileName1 : String;
//var tileName1 : String;

function revealCardOne()
{
	matchOne = hit.transform.gameObject;
	tileName1 = matchOne.transform.parent.name;
	
	if (matchOne == null)
	{
		print("No object found!");
	}
	else
	{
		tName1 = tileName1.Split("_"[0]);
	}
	

}

It does sound stupid but when the 1st line of var tileName1 : String; is used
it gives me this error:

Assets/TileGenerator_Script.js(91,47): BCE0022: Cannot convert ‘String’ to ‘System.Type’.
Assets/TileGenerator_Script.js(99,36): BCE0019: ‘Split’ is not a member of ‘System.Type’.

But when I used the 2nd one, i retype again, it doesn’t give me any error at all. Is it a bug or am I miss out something?

Thanks

From your description it is very likely what you actually typed was:

   var tileName1 = String;

Which makes tileName1 a variable of type Type containing the type of a String.