how to check for component in script unity code example
Example: unity check if a gameobject has a component
if(gameObjectToCheck.GetComponent<Rigidbody>() != null) { //do something }
if(gameObjectToCheck.GetComponent<Rigidbody>() != null) { //do something }