I have tried using:
TestComponent temp = gameObject.GetComponent<TestComponent >();
if (temp != null)
{
//...do things
}
However, it gives me an error when I first try to use GetComponent.
I can suppress the error with try/catch block, but what is the way to handle it if I do not have a way to be sure that the object has specific component?