How to check if object contains component 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 }