public GameObject myObject;
public string myObjectStringName;
if(myObject.name == myObjectStringName)
{
}
The problem is in additional words, like object count numbers or information about clone.
For example
myObject(111) or myObject(clone) is not equal “myObject” string cause contains additional words.
Either what JVene said in his comment or you dig into Regular expressions
Use this
public GameObject myObject;
public string myObjectString;
string tempMyObjectString;
tempMyObjectString = myObject.name.Substring (0,8);
if(tempMyObjectString == myObjectString)
{
}
by doing so you will be shrinking the “myObject” name and removing the data after 8 characters and thus if both Objects have same 8 characters the if statement will be true!